2020-08-18 11:57:53 +02:00
|
|
|
---
|
2021-11-23 21:26:18 +01:00
|
|
|
- name: include user tasks
|
|
|
|
include_tasks: user.yml
|
|
|
|
|
2020-08-18 11:57:53 +02:00
|
|
|
- name: create directories
|
|
|
|
become: yes
|
2020-11-21 19:41:19 +01:00
|
|
|
ansible.builtin.file:
|
2020-08-18 11:57:53 +02:00
|
|
|
path: "{{ item }}"
|
|
|
|
state: directory
|
2021-11-23 21:26:18 +01:00
|
|
|
owner: "{{ cv4pve_user }}"
|
|
|
|
group: "{{ cv4pve_user_group }}"
|
2020-08-18 11:57:53 +02:00
|
|
|
loop:
|
|
|
|
- '/tmp/cv4pve'
|
|
|
|
- '/usr/local/bin/cv4pve'
|
|
|
|
|
|
|
|
- name: download archives
|
|
|
|
become: yes
|
2021-11-23 21:26:18 +01:00
|
|
|
ansible.builtin.get_url:
|
2020-12-14 15:05:12 +01:00
|
|
|
url: "{{ cv4pve_dl_link }}"
|
2020-08-18 11:57:53 +02:00
|
|
|
dest: /tmp/cv4pve/cv4pve-autosnap-linux-x64.zip
|
|
|
|
mode: '0775'
|
|
|
|
|
2021-11-23 21:26:18 +01:00
|
|
|
- name: extract archives
|
2020-08-18 11:57:53 +02:00
|
|
|
become: yes
|
2020-11-21 19:41:19 +01:00
|
|
|
ansible.builtin.unarchive:
|
2020-08-18 11:57:53 +02:00
|
|
|
src: /tmp/cv4pve/cv4pve-autosnap-linux-x64.zip
|
|
|
|
dest: /usr/local/bin/cv4pve
|
|
|
|
remote_src: yes
|
|
|
|
mode: a+x
|
2021-11-23 21:26:18 +01:00
|
|
|
owner: "{{ cv4pve_user }}"
|
|
|
|
group: "{{ cv4pve_user_group }}"
|
2020-08-18 11:57:53 +02:00
|
|
|
|
|
|
|
- name: copy bash-script
|
|
|
|
become: yes
|
2020-11-21 19:41:19 +01:00
|
|
|
ansible.builtin.template:
|
2020-08-18 11:57:53 +02:00
|
|
|
src: "cv4pve-script.sh"
|
|
|
|
dest: "/usr/local/bin/cv4pve/cv4pve-script.sh"
|
|
|
|
mode: a+x
|
2021-11-23 21:26:18 +01:00
|
|
|
owner: "{{ cv4pve_user }}"
|
|
|
|
group: "{{ cv4pve_user_group }}"
|
2020-08-18 11:57:53 +02:00
|
|
|
|
|
|
|
- name: create cronjob
|
|
|
|
become: yes
|
2020-11-21 19:41:19 +01:00
|
|
|
ansible.builtin.cron:
|
2020-08-18 11:57:53 +02:00
|
|
|
name: cv4pve-autosnap
|
|
|
|
state: present
|
|
|
|
job: "/usr/local/bin/cv4pve/cv4pve-script.sh"
|
|
|
|
minute: "{{ cv4pve_cron_minute }}"
|
|
|
|
hour: "{{ cv4pve_cron_hour }}"
|
2021-11-23 21:26:18 +01:00
|
|
|
user: "{{ cv4pve_user }}"
|
2020-08-18 11:57:53 +02:00
|
|
|
|
2021-11-23 21:26:18 +01:00
|
|
|
- name: create log
|
2020-08-18 11:57:53 +02:00
|
|
|
become: true
|
2020-11-21 19:41:19 +01:00
|
|
|
ansible.builtin.file:
|
2020-08-18 11:57:53 +02:00
|
|
|
path: /var/log/cv4pve-autosnap.log
|
|
|
|
state: touch
|
2021-11-23 21:26:18 +01:00
|
|
|
owner: "{{ cv4pve_user }}"
|
|
|
|
group: "{{ cv4pve_user_group }}"
|
2021-05-02 14:20:16 +02:00
|
|
|
mode: 0640
|
2020-08-18 11:57:53 +02:00
|
|
|
access_time: preserve
|
|
|
|
modification_time: preserve
|
|
|
|
|
2021-03-13 22:11:57 +01:00
|
|
|
- name: copy logrotate config
|
|
|
|
become: yes
|
|
|
|
ansible.builtin.template:
|
|
|
|
src: logrotate_cv4pve
|
|
|
|
dest: /etc/logrotate.d/cv4pve-autosnap
|
2021-11-23 21:26:18 +01:00
|
|
|
owner: "{{ cv4pve_user }}"
|
|
|
|
group: "{{ cv4pve_user_group }}"
|
2020-08-18 11:57:53 +02:00
|
|
|
mode: 0644
|