mirror of https://github.com/Aidaho12/haproxy-wi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
5 years ago
|
- hosts: backup
|
||
|
become: yes
|
||
|
become_method: sudo
|
||
|
gather_facts: no
|
||
|
tasks:
|
||
|
- name: Creates directory
|
||
|
file:
|
||
|
path: "{{ RPATH }}/haproxy-wi-configs-backup/configs"
|
||
|
state: directory
|
||
|
owner: "{{ ansible_user }}"
|
||
|
when: DELJOB|length == 0
|
||
|
|
||
|
- hosts: haproxy_wi
|
||
|
become: yes
|
||
|
become_method: sudo
|
||
|
gather_facts: no
|
||
|
tasks:
|
||
|
|
||
|
- name: Creates backup jobs
|
||
|
cron:
|
||
|
name: "Backup HAProxy configs for user {{ SERVER }} {{ item }}"
|
||
|
special_time: "{{ TIME }}"
|
||
|
job: "rsync -arv {{ TYPE }} /var/www/haproxy-wi/configs/{{ item }}/{{ SERVER }}* {{ ansible_user }}@{{ HOST }}:{{ RPATH }}/haproxy-wi-configs-backup/configs/{{ item }} -e 'ssh -i {{ KEY }} -o StrictHostKeyChecking=no' --log-file=/var/www/haproxy-wi/log/backup.log"
|
||
|
when: DELJOB|length == 0
|
||
|
with_items:
|
||
|
- kp_config
|
||
|
- hap_config
|
||
|
|
||
|
- name: Removes backup jobs
|
||
|
cron:
|
||
|
name: "Backup HAProxy configs for user {{ SERVER }} {{ item }}"
|
||
|
state: absent
|
||
|
when: DELJOB|length > 0
|
||
|
with_items:
|
||
|
- kp_config
|
||
|
- hap_config
|