homelab/roles/lander/tasks/main.yml

83 lines
1.9 KiB
YAML

---
- name: Ensure newest binary is present
ansible.builtin.get_url:
url: "https://s3.rustybever.be/lander/commits/{{ lander_commit_sha }}/lander-linux-arm64"
dest: '/usr/local/bin/lander'
owner: 'root'
group: 'root'
mode: '0755'
notify: lander-restart
- name: Ensure system group exists
ansible.builtin.group:
name: 'lander'
gid: 201
system: true
state: present
- name: Ensure system user exists
ansible.builtin.user:
name: 'lander'
group: 'lander'
uid: 201
system: true
create_home: false
# Only one BTRFS file system should be mounted, so this will match that one
- name: Ensure data subvolume is present
community.general.btrfs_subvolume:
name: '/lander'
- name: Ensure data subvolume permissions are correct
ansible.builtin.file:
path: '/mnt/data1/lander'
state: directory
mode: '0755'
owner: 'lander'
group: 'lander'
- name: Ensure configuration directory is present
ansible.builtin.file:
path: '/etc/lander'
state: directory
mode: '0755'
owner: 'lander'
group: 'lander'
- name: Ensure environment file is present
ansible.builtin.template:
src: 'lander.env.j2'
dest: '/etc/lander/lander.env'
owner: 'lander'
group: 'lander'
mode: '0644'
notify: lander-restart
- name: Ensure backup script is present
ansible.builtin.copy:
src: 'lander.backup.sh'
dest: '/etc/backups/lander.backup.sh'
owner: 'root'
group: 'root'
mode: '0644'
- name: Ensure service file is present
ansible.builtin.copy:
src: 'lander.service'
dest: '/lib/systemd/system/lander.service'
owner: 'root'
group: 'root'
mode: '0644'
register: res
- name: systemd-reload
ansible.builtin.systemd_service:
daemon_reload: true
when: 'res.changed'
- name: Ensure lander service is enabled
ansible.builtin.service:
name: 'lander'
state: started
enabled: true