homeserver/roles/mgrote_cv4pve_autosnap/tasks/main.yml
Michael Grote dc3c0e8ffb
Some checks failed
ci/woodpecker/push/gitleaks Pipeline was successful
ci/woodpecker/push/ansible-lint Pipeline failed
ff
2024-04-14 21:11:16 +02:00

75 lines
1.8 KiB
YAML

---
- name: include user tasks
ansible.builtin.include_tasks: user.yml
- name: create directories
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: "{{ cv4pve_user }}"
group: "{{ cv4pve_user_group }}"
mode: "0644"
loop:
- '/usr/local/bin/cv4pve-{{ cv4pve_version }}/'
- name: download archives
ansible.builtin.unarchive:
src: "{{ cv4pve_dl_link }}"
dest: /usr/local/bin/cv4pve/
mode: '0775'
owner: "{{ cv4pve_user }}"
group: "{{ cv4pve_user_group }}"
remote_src: yes
creates: /usr/local/bin/cv4pve/cv4pve-autosnap-{{ cv4pve_version }}
list_files: true
register: download
- name: move
ansible.builtin.command: |
mv /usr/local/bin/cv4pve/cv4pve-autosnap /usr/local/bin/cv4pve/cv4pve-autosnap-{{ cv4pve_version }}
when: download.changed
- name: template cv4pve.service
ansible.builtin.template:
src: cv4pve.service.j2
dest: /etc/systemd/system/cv4pve.service
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
- name: template cv4pve_mail.service
ansible.builtin.template:
src: cv4pve_mail.service.j2
dest: /etc/systemd/system/cv4pve_mail.service
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
- name: template cv4pve.timer
ansible.builtin.template:
src: cv4pve.timer.j2
dest: /etc/systemd/system/cv4pve.timer
owner: root
group: root
mode: "0644"
notify:
- systemctl daemon-reload
- name: systemctl start cv4pve.timer
ansible.builtin.systemd:
name: cv4pve.timer
state: started
enabled: true
- name: remove old cv4pve versions
ansible.builtin.command: |
rm -rf /tmp/cv4pve/cv4pve-autosnap-linux-x64-{{ cv4pve_version }}
path: "{{ item['path'] }}"
state: absent
with_items: "{{ find_results['files'] }}"
...