changed sites loop var to 'site' instead of 'item'
This commit is contained in:
parent
79fd998cce
commit
c2fc791dbb
1 changed files with 10 additions and 10 deletions
|
@ -1,26 +1,26 @@
|
||||||
---
|
---
|
||||||
# Needs variables:
|
# Needs variables:
|
||||||
# - item: dict describing the site install (cf group_vars/all/vars.yml)
|
# - site: dict describing the site install (cf group_vars/all/vars.yml)
|
||||||
# - site_data_path: path of the site's data
|
# - site_data_path: path of the site's data
|
||||||
|
|
||||||
- name: "Data backups"
|
- name: "Data backups"
|
||||||
block:
|
block:
|
||||||
- name: "Setup weekly backup of site's data"
|
- name: "Setup weekly backup of site's data"
|
||||||
cron:
|
cron:
|
||||||
name: "backup {{ item.slug }} data"
|
name: "backup {{ site.slug }} data"
|
||||||
# hour: "{{ 24 | random }}"
|
# hour: "{{ 24 | random }}"
|
||||||
# minute: "{{ 60 | random }}"
|
# minute: "{{ 60 | random }}"
|
||||||
special_time: weekly
|
special_time: weekly
|
||||||
user: "root"
|
user: "root"
|
||||||
job: "tar czf {{ backups_path }}/{{ item.slug }}.tar.gz {{ site_data_path }}"
|
job: "tar czf {{ backups_path }}/{{ site.slug }}.tar.gz {{ site_data_path }}"
|
||||||
become: yes
|
become: yes
|
||||||
- name: "Setup data backup rotation with logrotate"
|
- name: "Setup data backup rotation with logrotate"
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: "/etc/logrotate.d/{{ item.slug }}"
|
path: "/etc/logrotate.d/{{ site.slug }}"
|
||||||
marker: "# {mark} DATA BACKUP"
|
marker: "# {mark} DATA BACKUP"
|
||||||
create: yes
|
create: yes
|
||||||
block: |
|
block: |
|
||||||
{{ backups_path }}/{{ item.slug }}.tar.gz {
|
{{ backups_path }}/{{ site.slug }}.tar.gz {
|
||||||
weekly
|
weekly
|
||||||
rotate 4
|
rotate 4
|
||||||
nocompress
|
nocompress
|
||||||
|
@ -38,18 +38,18 @@
|
||||||
# putting the password in the crontab
|
# putting the password in the crontab
|
||||||
- name: "Setup weekly backup of database"
|
- name: "Setup weekly backup of database"
|
||||||
cron:
|
cron:
|
||||||
name: "backup {{ item.slug }} database"
|
name: "backup {{ site.slug }} database"
|
||||||
special_time: weekly
|
special_time: weekly
|
||||||
user: "root" # need root for passwordless mysqldump
|
user: "root" # need root for passwordless mysqldump
|
||||||
job: "mysqldump {{ item.mysql_database }} | gzip -c > {{ backups_path }}/{{ item.slug }}.sql.gz"
|
job: "mysqldump {{ site.mysql_database }} | gzip -c > {{ backups_path }}/{{ site.slug }}.sql.gz"
|
||||||
become: yes
|
become: yes
|
||||||
- name: "Setup database backup rotation with logrotate"
|
- name: "Setup database backup rotation with logrotate"
|
||||||
blockinfile:
|
blockinfile:
|
||||||
path: "/etc/logrotate.d/{{ item.slug }}"
|
path: "/etc/logrotate.d/{{ site.slug }}"
|
||||||
marker: "# {mark} DATABASE BACKUP"
|
marker: "# {mark} DATABASE BACKUP"
|
||||||
create: yes
|
create: yes
|
||||||
block: |
|
block: |
|
||||||
{{ backups_path }}/{{ item.slug }}.sql.gz {
|
{{ backups_path }}/{{ site.slug }}.sql.gz {
|
||||||
weekly
|
weekly
|
||||||
rotate 4
|
rotate 4
|
||||||
nocompress
|
nocompress
|
||||||
|
@ -59,4 +59,4 @@
|
||||||
missingok
|
missingok
|
||||||
}
|
}
|
||||||
become: yes
|
become: yes
|
||||||
when: item.mysql_database is defined
|
when: site.mysql_database is defined
|
||||||
|
|
Loading…
Reference in a new issue