added backup and backup rotation to wordpress
This commit is contained in:
parent
812ae572d8
commit
12ff2735a1
2 changed files with 51 additions and 18 deletions
|
@ -5,6 +5,7 @@ adrien_serenity_password: "{{ vault_adrien_serenity_password }}"
|
|||
|
||||
www_path: /vault/www
|
||||
sites_path: /vault/sites
|
||||
backups_path: /vault/backups
|
||||
|
||||
wordpress:
|
||||
version: 5.4
|
||||
|
@ -101,21 +102,21 @@ sites:
|
|||
mysql_username: lexperimental
|
||||
mysql_password: "{{ vault_lexperimental_mysql_password }}"
|
||||
|
||||
# - slug: mts # Shorthand name to use as directory/file name
|
||||
# # The site URL (without www)
|
||||
# url: editionsmangetasoupe.fr
|
||||
# # Ask nginx to redirect url to www
|
||||
# # Else, we redirect www to url
|
||||
# redirect_to_www: no
|
||||
# # What kind of site is that?
|
||||
# type: drupal
|
||||
# # Subnet addresses
|
||||
# subnet_cidr_address: 172.27.5.0/24
|
||||
# subnet_gateway_ip: 172.27.5.1
|
||||
# subnet_site_ip: 172.27.5.2
|
||||
# # This will allow setting up MySQL
|
||||
# # Configuration on Drupal's side must be done by hand:
|
||||
# # Edit your <drupal_install>/sites/default/settings.php
|
||||
# mysql_database: mts8
|
||||
# mysql_username: mts
|
||||
# mysql_password: "{{ vault_mts_mysql_password }}"
|
||||
- slug: mts # Shorthand name to use as directory/file name
|
||||
# The site URL (without www)
|
||||
url: editionsmangetasoupe.fr
|
||||
# Ask nginx to redirect url to www
|
||||
# Else, we redirect www to url
|
||||
redirect_to_www: no
|
||||
# What kind of site is that?
|
||||
type: drupal
|
||||
# Subnet addresses
|
||||
subnet_cidr_address: 172.27.5.0/24
|
||||
subnet_gateway_ip: 172.27.5.1
|
||||
subnet_site_ip: 172.27.5.2
|
||||
# This will allow setting up MySQL
|
||||
# Configuration on Drupal's side must be done by hand:
|
||||
# Edit your <drupal_install>/sites/default/settings.php
|
||||
mysql_database: mts8
|
||||
mysql_username: mts
|
||||
mysql_password: "{{ vault_mts_mysql_password }}"
|
||||
|
|
|
@ -52,6 +52,38 @@
|
|||
when: wpcontent.stat.exists is not defined or wpcontent.stat.exists == False
|
||||
tags: [docker, nginx]
|
||||
|
||||
#################
|
||||
# Setup backups #
|
||||
#################
|
||||
|
||||
- name: Setup weekly backup of wp-content
|
||||
cron:
|
||||
name: "backup {{ item.slug }}_wp-content"
|
||||
# hour: "17"
|
||||
# minute: "37"
|
||||
special_time: weekly
|
||||
user: "www-data"
|
||||
job: "tar czf {{ backups_path }}/{{ item.slug }}_wp-content.tar.gz {{ www_path }}/{{ item.slug }}_wp-content"
|
||||
become: yes
|
||||
tags: backup
|
||||
|
||||
- name: Configure logrotate to rotate backups
|
||||
blockinfile:
|
||||
path: "/etc/logrotate.d/{{ item.slug }}"
|
||||
create: yes
|
||||
block: |
|
||||
{{ backups_path }}/{{ item.slug }}_wp-content.tar.gz {
|
||||
rotate 5
|
||||
nocompress
|
||||
dateext
|
||||
dateformat _%Y-%m-%d
|
||||
extension .tar.gz
|
||||
missingok
|
||||
}
|
||||
become: yes
|
||||
tags: backup
|
||||
|
||||
|
||||
####################
|
||||
# Render templates #
|
||||
####################
|
||||
|
|
Loading…
Reference in a new issue