better backps, gitea up to date
This commit is contained in:
parent
8e1e2beb47
commit
6742104999
3 changed files with 176 additions and 168 deletions
|
@ -11,7 +11,7 @@ wordpress:
|
||||||
version: 5.4
|
version: 5.4
|
||||||
checksum: sha1:d5f1e6d7cadd72c11d086a2e1ede0a72f23d993e
|
checksum: sha1:d5f1e6d7cadd72c11d086a2e1ede0a72f23d993e
|
||||||
gitea:
|
gitea:
|
||||||
version: 1.11.4
|
version: 1.12.1
|
||||||
synapse:
|
synapse:
|
||||||
version: v1.15.1-py3
|
version: v1.15.1-py3
|
||||||
|
|
||||||
|
@ -19,118 +19,118 @@ postgres:
|
||||||
pg_hba_path: "/etc/postgresql/9.6/main/pg_hba.conf"
|
pg_hba_path: "/etc/postgresql/9.6/main/pg_hba.conf"
|
||||||
|
|
||||||
sites:
|
sites:
|
||||||
# - slug: rdb # Shorthand name to use as directory/file name
|
- slug: rdb # Shorthand name to use as directory/file name
|
||||||
# # The site URL (without www)
|
# The site URL (without www)
|
||||||
# url: rennesdesbois.fr
|
url: rennesdesbois.fr
|
||||||
# # Ask nginx to redirect url to www
|
# Ask nginx to redirect url to www
|
||||||
# # Else, we redirect www to url
|
# Else, we redirect www to url
|
||||||
# redirect_to_www: yes
|
redirect_to_www: yes
|
||||||
# # What kind of site is that?
|
# What kind of site is that?
|
||||||
# type: wordpress
|
type: wordpress
|
||||||
# # Subnet addresses
|
# Subnet addresses
|
||||||
# subnet_cidr_address: 172.27.1.0/24
|
subnet_cidr_address: 172.27.1.0/24
|
||||||
# subnet_gateway_ip: 172.27.1.1
|
subnet_gateway_ip: 172.27.1.1
|
||||||
# subnet_nginx_ip: 172.27.1.2
|
subnet_nginx_ip: 172.27.1.2
|
||||||
# subnet_site_ip: 172.27.1.3
|
subnet_site_ip: 172.27.1.3
|
||||||
# # MySQL
|
# MySQL
|
||||||
# mysql_database: rdb
|
mysql_database: rdb
|
||||||
# mysql_username: rdb
|
mysql_username: rdb
|
||||||
# mysql_password: "{{ vault_rdb_mysql_password }}"
|
mysql_password: "{{ vault_rdb_mysql_password }}"
|
||||||
|
|
||||||
# - slug: arvuhez # Shorthand name to use as directory/file name
|
- slug: arvuhez # Shorthand name to use as directory/file name
|
||||||
# # The site URL (without www)
|
# The site URL (without www)
|
||||||
# url: arvuhez.org
|
url: arvuhez.org
|
||||||
# # Ask nginx to redirect url to www
|
# Ask nginx to redirect url to www
|
||||||
# # Else, we redirect www to url
|
# Else, we redirect www to url
|
||||||
# redirect_to_www: no
|
redirect_to_www: no
|
||||||
# # What kind of site is that?
|
# What kind of site is that?
|
||||||
# type: wordpress
|
type: wordpress
|
||||||
# # Subnet addresses
|
# Subnet addresses
|
||||||
# subnet_cidr_address: 172.27.2.0/24
|
subnet_cidr_address: 172.27.2.0/24
|
||||||
# subnet_gateway_ip: 172.27.2.1
|
subnet_gateway_ip: 172.27.2.1
|
||||||
# subnet_nginx_ip: 172.27.2.2
|
subnet_nginx_ip: 172.27.2.2
|
||||||
# subnet_site_ip: 172.27.2.3
|
subnet_site_ip: 172.27.2.3
|
||||||
# # MySQL
|
# MySQL
|
||||||
# mysql_database: arvuhez
|
mysql_database: arvuhez
|
||||||
# mysql_username: arvuhez
|
mysql_username: arvuhez
|
||||||
# mysql_password: "{{ vault_arvuhez_mysql_password }}"
|
mysql_password: "{{ vault_arvuhez_mysql_password }}"
|
||||||
|
|
||||||
# - slug: zinzoscope # Shorthand name to use as directory/file name
|
- slug: zinzoscope # Shorthand name to use as directory/file name
|
||||||
# # The site URL (without www)
|
# The site URL (without www)
|
||||||
# url: zinz.luxeylab.net
|
url: zinz.luxeylab.net
|
||||||
# # Ask nginx to redirect url to www
|
# Ask nginx to redirect url to www
|
||||||
# # Else, we redirect www to url
|
# Else, we redirect www to url
|
||||||
# redirect_to_www: no
|
redirect_to_www: no
|
||||||
# # What kind of site is that?
|
# What kind of site is that?
|
||||||
# type: wordpress
|
type: wordpress
|
||||||
# # Subnet addresses
|
# Subnet addresses
|
||||||
# subnet_cidr_address: 172.27.3.0/24
|
subnet_cidr_address: 172.27.3.0/24
|
||||||
# subnet_gateway_ip: 172.27.3.1
|
subnet_gateway_ip: 172.27.3.1
|
||||||
# subnet_nginx_ip: 172.27.3.2
|
subnet_nginx_ip: 172.27.3.2
|
||||||
# subnet_site_ip: 172.27.3.3
|
subnet_site_ip: 172.27.3.3
|
||||||
# # MySQL
|
# MySQL
|
||||||
# mysql_database: zinzoscope
|
mysql_database: zinzoscope
|
||||||
# mysql_username: zinzoscope
|
mysql_username: zinzoscope
|
||||||
# mysql_password: "{{ vault_zinzoscope_mysql_password }}"
|
mysql_password: "{{ vault_zinzoscope_mysql_password }}"
|
||||||
|
|
||||||
# - slug: lexperimental # Shorthand name to use as directory/file name
|
- slug: lexperimental # Shorthand name to use as directory/file name
|
||||||
# # The site URL (without www)
|
# The site URL (without www)
|
||||||
# url: lexperimental.fr
|
url: lexperimental.fr
|
||||||
# # Ask nginx to redirect url to www
|
# Ask nginx to redirect url to www
|
||||||
# # Else, we redirect www to url
|
# Else, we redirect www to url
|
||||||
# redirect_to_www: no
|
redirect_to_www: no
|
||||||
# # What kind of site is that?
|
# What kind of site is that?
|
||||||
# type: wordpress
|
type: wordpress
|
||||||
# # Subnet addresses
|
# Subnet addresses
|
||||||
# subnet_cidr_address: 172.27.4.0/24
|
subnet_cidr_address: 172.27.4.0/24
|
||||||
# subnet_gateway_ip: 172.27.4.1
|
subnet_gateway_ip: 172.27.4.1
|
||||||
# subnet_nginx_ip: 172.27.4.2
|
subnet_nginx_ip: 172.27.4.2
|
||||||
# subnet_site_ip: 172.27.4.3
|
subnet_site_ip: 172.27.4.3
|
||||||
# # MySQL
|
# MySQL
|
||||||
# mysql_database: lexperimental
|
mysql_database: lexperimental
|
||||||
# mysql_username: lexperimental
|
mysql_username: lexperimental
|
||||||
# mysql_password: "{{ vault_lexperimental_mysql_password }}"
|
mysql_password: "{{ vault_lexperimental_mysql_password }}"
|
||||||
|
|
||||||
# - slug: mts # Shorthand name to use as directory/file name
|
- slug: mts # Shorthand name to use as directory/file name
|
||||||
# # The site URL (without www)
|
# The site URL (without www)
|
||||||
# url: editionsmangetasoupe.fr
|
url: editionsmangetasoupe.fr
|
||||||
# # Ask nginx to redirect url to www
|
# Ask nginx to redirect url to www
|
||||||
# # Else, we redirect www to url
|
# Else, we redirect www to url
|
||||||
# redirect_to_www: no
|
redirect_to_www: no
|
||||||
# # What kind of site is that?
|
# What kind of site is that?
|
||||||
# type: drupal
|
type: drupal
|
||||||
# # Subnet addresses
|
# Subnet addresses
|
||||||
# subnet_cidr_address: 172.27.5.0/24
|
subnet_cidr_address: 172.27.5.0/24
|
||||||
# subnet_gateway_ip: 172.27.5.1
|
subnet_gateway_ip: 172.27.5.1
|
||||||
# subnet_site_ip: 172.27.5.2
|
subnet_site_ip: 172.27.5.2
|
||||||
# # This will allow setting up MySQL
|
# This will allow setting up MySQL
|
||||||
# # Configuration on Drupal's side must be done by hand:
|
# Configuration on Drupal's side must be done by hand:
|
||||||
# # Edit your <drupal_install>/sites/default/settings.php
|
# Edit your <drupal_install>/sites/default/settings.php
|
||||||
# mysql_database: mts8
|
mysql_database: mts8
|
||||||
# mysql_username: mts
|
mysql_username: mts
|
||||||
# mysql_password: "{{ vault_mts_mysql_password }}"
|
mysql_password: "{{ vault_mts_mysql_password }}"
|
||||||
|
|
||||||
# - slug: gitea # Shorthand name to use as directory/file name
|
- slug: gitea # Shorthand name to use as directory/file name
|
||||||
# # The site URL (without www)
|
# The site URL (without www)
|
||||||
# url: git.deuxfleurs.fr
|
url: git.deuxfleurs.fr
|
||||||
# # Ask nginx to redirect url to www
|
# Ask nginx to redirect url to www
|
||||||
# # Else, we redirect www to url
|
# Else, we redirect www to url
|
||||||
# redirect_to_www: no
|
redirect_to_www: no
|
||||||
# # What kind of site is that?
|
# What kind of site is that?
|
||||||
# type: gitea
|
type: gitea
|
||||||
# # Subnet addresses
|
# Subnet addresses
|
||||||
# subnet_cidr_address: 172.27.6.0/24
|
subnet_cidr_address: 172.27.6.0/24
|
||||||
# subnet_gateway_ip: 172.27.6.1
|
subnet_gateway_ip: 172.27.6.1
|
||||||
# subnet_site_ip: 172.27.6.2
|
subnet_site_ip: 172.27.6.2
|
||||||
# # User IDs
|
# User IDs
|
||||||
# user_name: git
|
user_name: git
|
||||||
# user_uid: 1007
|
user_uid: 1007
|
||||||
# user_group: git
|
user_group: git
|
||||||
# user_gid: 1006
|
user_gid: 1006
|
||||||
# # MySQL
|
# MySQL
|
||||||
# mysql_database: gitea
|
mysql_database: gitea
|
||||||
# mysql_username: gitea
|
mysql_username: gitea
|
||||||
# mysql_password: "{{ vault_gitea_mysql_password }}"
|
mysql_password: "{{ vault_gitea_mysql_password }}"
|
||||||
|
|
||||||
- slug: synapse # Shorthand name to use as directory/file name
|
- slug: synapse # Shorthand name to use as directory/file name
|
||||||
# The site URL (without www)
|
# The site URL (without www)
|
||||||
|
|
|
@ -3,64 +3,72 @@
|
||||||
# - site: 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"
|
|
||||||
block:
|
- name: "Setup periodic site files backup"
|
||||||
- name: "Setup weekly backup of site's data"
|
blockinfile:
|
||||||
cron:
|
path: "/etc/logrotate.d/{{ site.slug }}"
|
||||||
name: "backup {{ site.slug }} data"
|
marker: "# {mark} DATA BACKUP"
|
||||||
# hour: "{{ 24 | random }}"
|
create: yes
|
||||||
# minute: "{{ 60 | random }}"
|
block: |
|
||||||
special_time: weekly
|
{{ backups_path }}/{{ site.slug }}.tar.gz {
|
||||||
user: "root"
|
prerotate
|
||||||
job: "tar czf {{ backups_path }}/{{ site.slug }}.tar.gz {{ site_data_path }}"
|
tar czf {{ backups_path }}/{{ site.slug }}.tar.gz {{ site_data_path }}
|
||||||
become: yes
|
endscript
|
||||||
- name: "Setup data backup rotation with logrotate"
|
weekly
|
||||||
blockinfile:
|
rotate 4
|
||||||
path: "/etc/logrotate.d/{{ site.slug }}"
|
nocompress
|
||||||
marker: "# {mark} DATA BACKUP"
|
dateext
|
||||||
create: yes
|
dateformat _%Y-%m-%d
|
||||||
block: |
|
extension .tar.gz
|
||||||
{{ backups_path }}/{{ site.slug }}.tar.gz {
|
missingok
|
||||||
weekly
|
su www-data www-data
|
||||||
rotate 4
|
nocreate
|
||||||
nocompress
|
}
|
||||||
dateext
|
become: yes
|
||||||
dateformat _%Y-%m-%d
|
|
||||||
extension .tar.gz
|
|
||||||
missingok
|
|
||||||
}
|
|
||||||
become: yes
|
|
||||||
when: site_data_path is defined
|
when: site_data_path is defined
|
||||||
|
|
||||||
- name: "MySQL Database backups"
|
- name: "Setup periodic MySQL database backup"
|
||||||
block:
|
blockinfile:
|
||||||
# You need your root MySQL password stored in /root/.my.cnf to avoid
|
path: "/etc/logrotate.d/{{ site.slug }}"
|
||||||
# putting the password in the crontab
|
marker: "# {mark} DATABASE BACKUP"
|
||||||
- name: "Setup weekly backup of database"
|
create: yes
|
||||||
cron:
|
block: |
|
||||||
name: "backup {{ site.slug }} database"
|
{{ backups_path }}/{{ site.slug }}.sql.gz {
|
||||||
special_time: weekly
|
prerotate
|
||||||
user: "root" # need root for passwordless mysqldump
|
mysqldump {{ site.mysql_database }} | gzip -c > {{ backups_path }}/{{ site.slug }}.sql.gz
|
||||||
job: "mysqldump {{ site.mysql_database }} | gzip -c > {{ backups_path }}/{{ site.slug }}.sql.gz"
|
endscript
|
||||||
become: yes
|
weekly
|
||||||
- name: "Setup database backup rotation with logrotate"
|
rotate 4
|
||||||
blockinfile:
|
nocompress
|
||||||
path: "/etc/logrotate.d/{{ site.slug }}"
|
dateext
|
||||||
marker: "# {mark} DATABASE BACKUP"
|
dateformat _%Y-%m-%d
|
||||||
create: yes
|
extension .sql.gz
|
||||||
block: |
|
missingok
|
||||||
{{ backups_path }}/{{ site.slug }}.sql.gz {
|
su www-data www-data
|
||||||
weekly
|
nocreate
|
||||||
rotate 4
|
}
|
||||||
nocompress
|
become: yes
|
||||||
dateext
|
|
||||||
dateformat _%Y-%m-%d
|
|
||||||
extension .sql.gz
|
|
||||||
missingok
|
|
||||||
}
|
|
||||||
become: yes
|
|
||||||
when: site.mysql_database is defined
|
when: site.mysql_database is defined
|
||||||
|
|
||||||
- name: "PostgreSQL Database backups"
|
- name: "Setup periodic PostgreSQL database backup"
|
||||||
debug: msg="TODO PUTAIN BOSSE LÀ"
|
blockinfile:
|
||||||
|
path: "/etc/logrotate.d/{{ site.slug }}"
|
||||||
|
marker: "# {mark} DATABASE BACKUP"
|
||||||
|
create: yes
|
||||||
|
block: |
|
||||||
|
{{ backups_path }}/{{ site.slug }}.sql.gz {
|
||||||
|
prerotate
|
||||||
|
sudo -u postgres pg_dump {{ site.postgres_database }} | gzip -c > {{ backups_path }}/{{ site.slug }}.sql.gz
|
||||||
|
endscript
|
||||||
|
weekly
|
||||||
|
rotate 4
|
||||||
|
nocompress
|
||||||
|
dateext
|
||||||
|
dateformat _%Y-%m-%d
|
||||||
|
extension .sql.gz
|
||||||
|
missingok
|
||||||
|
su www-data www-data
|
||||||
|
nocreate
|
||||||
|
}
|
||||||
|
become: yes
|
||||||
when: site.postgres_database is defined
|
when: site.postgres_database is defined
|
|
@ -6,7 +6,7 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: site
|
loop_var: site
|
||||||
when: site.type == "wordpress"
|
when: site.type == "wordpress"
|
||||||
tags: wordpress
|
tags: wordpress,sites
|
||||||
|
|
||||||
- name: Build Drupal sites
|
- name: Build Drupal sites
|
||||||
include_tasks: drupal.yml
|
include_tasks: drupal.yml
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: site
|
loop_var: site
|
||||||
when: site.type == "drupal"
|
when: site.type == "drupal"
|
||||||
tags: drupal
|
tags: drupal,sites
|
||||||
|
|
||||||
- name: Build Gitea sites
|
- name: Build Gitea sites
|
||||||
include_tasks: gitea.yml
|
include_tasks: gitea.yml
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: site
|
loop_var: site
|
||||||
when: site.type == "gitea"
|
when: site.type == "gitea"
|
||||||
tags: gitea
|
tags: gitea,sites
|
||||||
|
|
||||||
- name: Build Synapse sites
|
- name: Build Synapse sites
|
||||||
include_tasks: synapse.yml
|
include_tasks: synapse.yml
|
||||||
|
@ -30,4 +30,4 @@
|
||||||
loop_control:
|
loop_control:
|
||||||
loop_var: site
|
loop_var: site
|
||||||
when: site.type == "synapse"
|
when: site.type == "synapse"
|
||||||
tags: synapse
|
tags: synapse,sites
|
||||||
|
|
Loading…
Reference in a new issue