homeserver/roles/mgrote.cv4pve-autosnap/tasks/main.yml
mg 8d5686bc38 cv4pve: CL-Link als Variable (#3)
cv4pve: CL-Link als Variable

Co-authored-by: Michael Grote <38253905+quotengrote@users.noreply.github.com>
Reviewed-on: mg/ansible#3
2020-12-14 15:05:12 +01:00

73 lines
1.7 KiB
YAML

---
- name: create directories
become: yes
ansible.builtin.file:
path: "{{ item }}"
state: directory
loop:
- '/tmp/cv4pve'
- '/usr/local/bin/cv4pve'
- name: download archives
become: yes
ansible.builtin.get_url: ## hier variable für version
url: "{{ cv4pve_dl_link }}"
dest: /tmp/cv4pve/cv4pve-autosnap-linux-x64.zip
mode: '0775'
- name: Extract archives
become: yes
ansible.builtin.unarchive:
src: /tmp/cv4pve/cv4pve-autosnap-linux-x64.zip
dest: /usr/local/bin/cv4pve
remote_src: yes
mode: a+x
- name: copy bash-script
become: yes
ansible.builtin.template:
src: "cv4pve-script.sh"
dest: "/usr/local/bin/cv4pve/cv4pve-script.sh"
mode: a+x
- name: create cronjob
become: yes
ansible.builtin.cron:
name: cv4pve-autosnap
state: present
job: "/usr/local/bin/cv4pve/cv4pve-script.sh"
minute: "{{ cv4pve_cron_minute }}"
hour: "{{ cv4pve_cron_hour }}"
- name: Create log
become: true
ansible.builtin.file:
path: /var/log/cv4pve-autosnap.log
state: touch
owner: root
group: root
mode: 0644
access_time: preserve
modification_time: preserve
- name: Add Log to be Rotated
become: true
ansible.builtin.blockinfile:
path: /etc/logrotate.d/cv4pve-autosnap
state: present
create: yes
owner: root
group: root
mode: 0644
block: |
/var/log/cv4pve-autosnap.log {
su root root
create 0640 root root
rotate 4
weekly
compress
missingok
notifempty
dateext
dateyesterday
}