diff --git a/roles/mgrote_cv4pve_autosnap/tasks/install.yml b/roles/mgrote_cv4pve_autosnap/tasks/install.yml index ace63a08..2c90d979 100644 --- a/roles/mgrote_cv4pve_autosnap/tasks/install.yml +++ b/roles/mgrote_cv4pve_autosnap/tasks/install.yml @@ -1,5 +1,5 @@ --- -- name: create directories +- name: Ensure needed directories exist ansible.builtin.file: path: "/usr/local/bin/cv4pve/" state: directory @@ -7,7 +7,7 @@ group: "{{ cv4pve_user_group }}" mode: "0644" -- name: download archives +- name: Download specified version ansible.builtin.unarchive: src: "{{ cv4pve_dl_link }}" dest: /usr/local/bin/cv4pve/ @@ -19,12 +19,13 @@ list_files: true register: download -- name: move +- name: Rename binary ansible.builtin.command: | mv /usr/local/bin/cv4pve/cv4pve-autosnap /usr/local/bin/cv4pve/cv4pve-autosnap-{{ cv4pve_version }} when: download.changed -- name: Capture files to delete +# https://stackoverflow.com/questions/20252057/using-ansible-how-would-i-delete-all-items-except-for-a-specified-set-in-a-dire +- name: Find old versions ansible.builtin.find: paths: /usr/local/bin/cv4pve file_type: file @@ -33,7 +34,7 @@ - "cv4pve-autosnap-{{ cv4pve_version }}" register: found_files -- name: Delete files +- name: Ensure old versions are absent ansible.builtin.file: path: "{{ item.path }}" state: absent diff --git a/roles/mgrote_cv4pve_autosnap/tasks/systemd.yml b/roles/mgrote_cv4pve_autosnap/tasks/systemd.yml index c72bd865..d089d485 100644 --- a/roles/mgrote_cv4pve_autosnap/tasks/systemd.yml +++ b/roles/mgrote_cv4pve_autosnap/tasks/systemd.yml @@ -1,5 +1,5 @@ --- -- name: template cv4pve.service +- name: Ensure service-unit (cv4pve) is templated ansible.builtin.template: src: cv4pve.service.j2 dest: /etc/systemd/system/cv4pve.service @@ -10,7 +10,7 @@ notify: - systemctl daemon-reload -- name: template cv4pve_mail.service +- name: Ensure service-unit (mail) is templated ansible.builtin.template: src: cv4pve_mail.service.j2 dest: /etc/systemd/system/cv4pve_mail.service @@ -20,7 +20,7 @@ notify: - systemctl daemon-reload -- name: template cv4pve.timer +- name: Ensure service-unit (timer) is templated ansible.builtin.template: src: cv4pve.timer.j2 dest: /etc/systemd/system/cv4pve.timer @@ -30,7 +30,7 @@ notify: - systemctl daemon-reload -- name: systemctl start cv4pve.timer +- name: Ensure timer is started is templated ansible.builtin.systemd: name: cv4pve.timer state: started diff --git a/roles/mgrote_cv4pve_autosnap/tasks/user.yml b/roles/mgrote_cv4pve_autosnap/tasks/user.yml index f304dc92..7ceab35b 100644 --- a/roles/mgrote_cv4pve_autosnap/tasks/user.yml +++ b/roles/mgrote_cv4pve_autosnap/tasks/user.yml @@ -1,5 +1,5 @@ --- -- name: ensure group exists +- name: Ensure group exists become: true ansible.builtin.group: name: "{{ cv4pve_user_group }}" @@ -7,7 +7,7 @@ when: - cv4pve_user_group is defined -- name: ensure user exists +- name: Ensure user exists become: true ansible.builtin.user: name: "{{ cv4pve_user }}"