homeserver/roles/mgrote_cv4pve_autosnap/tasks/main.yml

86 lines
1.9 KiB
YAML
Raw Normal View History

---
- name: include user tasks
ansible.builtin.include_tasks: user.yml
- name: create directories
ansible.builtin.file:
2024-04-14 21:14:26 +02:00
path: "/usr/local/bin/cv4pve/"
state: directory
owner: "{{ cv4pve_user }}"
group: "{{ cv4pve_user_group }}"
mode: "0644"
- name: download archives
2024-04-14 20:54:34 +02:00
ansible.builtin.unarchive:
src: "{{ cv4pve_dl_link }}"
2024-04-14 21:09:21 +02:00
dest: /usr/local/bin/cv4pve/
mode: '0775'
owner: "{{ cv4pve_user }}"
group: "{{ cv4pve_user_group }}"
2024-04-14 20:54:34 +02:00
remote_src: yes
2024-04-14 21:09:21 +02:00
creates: /usr/local/bin/cv4pve/cv4pve-autosnap-{{ cv4pve_version }}
list_files: true
2024-04-14 21:11:16 +02:00
register: download
2024-04-14 21:09:21 +02:00
- name: move
ansible.builtin.command: |
mv /usr/local/bin/cv4pve/cv4pve-autosnap /usr/local/bin/cv4pve/cv4pve-autosnap-{{ cv4pve_version }}
2024-04-14 21:11:16 +02:00
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
2024-04-14 21:09:21 +02:00
2024-04-14 21:17:13 +02:00
- name: Capture files to delete
find:
paths: /usr/local/bin/cv4pve
file_type: file
excludes:
- "/usr/local/bin/cv4pve/cv4pve-autosnap-{{ cv4pve_version }}"
register: found_files
2024-04-14 21:09:21 +02:00
2024-04-14 21:17:13 +02:00
- name: Delete files
file:
path: "{{ item.path }}"
2024-04-14 21:09:21 +02:00
state: absent
2024-04-14 21:17:13 +02:00
with_items: "{{ found_files['files'] }}"
2024-04-14 21:09:21 +02:00
...
2024-04-14 21:17:13 +02:00
# permissions
# etxte
#linter
# varioablen