homeserver/roles/mgrote.cv4pve-autosnap/tasks/main.yml
Quotengrote 15d783de86
FQCN eingeführt (#70)
* template --> ansible.builtin.template

* apt --> ansible.builtin.apt

* lineinfile --> ansible.builtin.lineinfile

* file --> ansible.builtin.file

* blockinfile --> ansible.builtin.blockinfile

* cron --> ansible.builtin.cron

* timezone --> ansible.builtin.timezone

* get_url --> ansible.builtin.get_url

* group --> ansible.builtin.group

* user --> ansible.builtin.user

* unarchive --> ansible.builtin.unarchive

* service --> ansible.builtin.service

* apache2_module --> ansible.builtin.apache2_module

* package --> ansible.builtin.apt

* template --> ansible.builtin.template 2
2020-11-21 19:41:19 +01:00

73 lines
1.8 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: https://github.com/Corsinvest/cv4pve-autosnap/releases/download/{{ cv4pve_version }}/cv4pve-autosnap-linux-x64.zip
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
}