cron and archive modules completed
This commit is contained in:
18
playbooks/backup-logs.yml
Normal file
18
playbooks/backup-logs.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
- hosts: all
|
||||
user: ansible
|
||||
become: yes
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Compress directory /var/log/ into /home/ansible/logs.zip
|
||||
archive:
|
||||
path: /var/log
|
||||
dest: /home/ansible/logs.tar.gz
|
||||
owner: ansible
|
||||
group: ansible
|
||||
format: gz
|
||||
- name: Fetch the log files to the local filesystem
|
||||
fetch:
|
||||
src: /home/ansible/logs.tar.gz
|
||||
dest: logbackup-{{ inventory_hostname }}.tar.gz
|
||||
flat: yes
|
||||
12
playbooks/cron-tasks.yml
Normal file
12
playbooks/cron-tasks.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- hosts: all
|
||||
user: ansible
|
||||
become: yes
|
||||
gather_facts: no
|
||||
tasks:
|
||||
- name: Ensure a job that runs at 5am and 5pm exists.
|
||||
cron:
|
||||
name: "Job 0001"
|
||||
minute: "0"
|
||||
hour: "5,17"
|
||||
job: "df -h >> /tmp/diskspace"
|
||||
Reference in New Issue
Block a user