upgraded synapse to 1.18.0 and improved tags overall (dynamic tasks include does not allow fot tags inheritance, had to surround inner tasks with a block defining the tag)

This commit is contained in:
LUXEY Adrien 2020-08-17 12:56:15 +02:00
parent 8acbc4f2b2
commit 801575ea38
10 changed files with 262 additions and 230 deletions

View file

@ -17,7 +17,7 @@ wordpress:
gitea:
version: 1.12.1
synapse:
version: v1.15.1-py3
version: v1.18.0
postgres:
pg_hba_path: "/etc/postgresql/9.6/main/pg_hba.conf"

View file

@ -1,33 +1,36 @@
---
- name: "Set site_data_path to {{ www_path }}/{{ site.slug }}"
- block: # Used for tagging all tasks with "drupal"
- name: "Set site_data_path to {{ www_path }}/{{ site.slug }}"
set_fact: site_data_path="{{ www_path }}/{{ site.slug }}"
tags: always
####################
# Render templates #
####################
####################
# Render templates #
####################
- name: "Create folder {{ sites_path }}/{{ site.slug }}"
- name: "Create folder {{ sites_path }}/{{ site.slug }}"
file:
path: "{{ sites_path }}/{{ site.slug }}"
state: directory
mode: '750'
tags: [docker, nginx, mysql]
- name: Render sexy Dockerfile
- name: Render sexy Dockerfile
template:
src: drupal/Dockerfile.j2
dest: "{{ sites_path }}/{{ site.slug }}/Dockerfile"
tags: docker
- name: Render marvelous docker-compose.yml
- name: Render marvelous docker-compose.yml
template:
src: drupal/docker-compose.yml.j2
dest: "{{ sites_path }}/{{ site.slug }}/docker-compose.yml"
tags: docker
- name: Render swell nginx site config
- name: Render swell nginx site config
template:
src: drupal/nginx.j2
dest: "/etc/nginx/sites-available/{{ site.url }}"
@ -35,31 +38,33 @@
tags: nginx
#######################
# MySQL configuration #
#######################
#######################
# MySQL configuration #
#######################
- name: "Setup MySQL"
- name: "Setup MySQL"
import_tasks: mysql.yml
tags: mysql
#################
# Setup backups #
#################
#################
# Setup backups #
#################
- name: "Setup backups"
- name: "Setup backups"
import_tasks: backup.yml
tags: backup
###################
# SSL certificate #
###################
###################
# SSL certificate #
###################
# - name: Create Let's Encrypt certificate
# This seems hard, see:
# https://docs.ansible.com/ansible/latest/modules/acme_certificate_module.html#acme-certificate-module
# https://www.digitalocean.com/community/tutorials/how-to-acquire-a-let-s-encrypt-certificate-using-ansible-on-ubuntu-18-04
# Maybe using shell directly? e.g.
# certbot certonly --webroot -w /var/www/letsencrypt -d <url>
# - name: Create Let's Encrypt certificate
# This seems hard, see:
# https://docs.ansible.com/ansible/latest/modules/acme_certificate_module.html#acme-certificate-module
# https://www.digitalocean.com/community/tutorials/how-to-acquire-a-let-s-encrypt-certificate-using-ansible-on-ubuntu-18-04
# Maybe using shell directly? e.g.
# certbot certonly --webroot -w /var/www/letsencrypt -d <url>
tags: drupal # /block

View file

@ -1,29 +1,33 @@
---
- name: "Set site_data_path to {{ www_path }}/{{ site.slug }}"
- block: # Used for tagging all tasks with "gitea"
- name: "Set site_data_path to {{ www_path }}/{{ site.slug }}"
set_fact: site_data_path="{{ www_path }}/{{ site.slug }}"
tags: always
####################
# Render templates #
####################
####################
# Render templates #
####################
- name: "Render templates"
- name: "Render templates"
import_tasks: render.yml
tags: render
#######################
# MySQL configuration #
#######################
#######################
# MySQL configuration #
#######################
- name: "Setup MySQL"
- name: "Setup MySQL"
import_tasks: mysql.yml
tags: mysql
#################
# Setup backups #
#################
#################
# Setup backups #
#################
- name: "Setup backups"
- name: "Setup backups"
import_tasks: backup.yml
tags: backup
tags: gitea # / block

View file

@ -6,7 +6,7 @@
loop_control:
loop_var: site
when: site.type == "wordpress"
tags: wordpress,sites
tags: wordpress
- name: Build Drupal sites
include_tasks: drupal.yml
@ -14,7 +14,7 @@
loop_control:
loop_var: site
when: site.type == "drupal"
tags: drupal,sites
tags: drupal
- name: Build Gitea sites
include_tasks: gitea.yml
@ -22,7 +22,7 @@
loop_control:
loop_var: site
when: site.type == "gitea"
tags: gitea,sites
tags: gitea
- name: Build Synapse sites
include_tasks: synapse.yml
@ -30,4 +30,4 @@
loop_control:
loop_var: site
when: site.type == "synapse"
tags: synapse,sites
tags: synapse

View file

@ -1,36 +1,36 @@
---
- name: "Set site_data_path to {{ www_path }}/{{ site.slug }}"
- block: # Used for tagging all tasks with "synapse"
- name: "Set site_data_path to {{ www_path }}/{{ site.slug }}"
set_fact: site_data_path="{{ www_path }}/{{ site.slug }}"
tags: always
####################
# Render templates #
####################
####################
# Render templates #
####################
- name: "Render templates"
- name: "Render templates"
import_tasks: render.yml
tags: render
##########################
# Generate configuration #
##########################
##########################
# Generate configuration #
##########################
- name: "Create folder {{ site_data_path }}"
- block: # Used for tagging all tasks with "config"
- name: "Create folder {{ site_data_path }}"
file:
path: "{{ site_data_path }}"
state: directory
mode: "770"
group: "www-data"
tags: config
- name: "Copy homeserver.yaml to {{ site_data_path }}"
- name: "Copy homeserver.yaml to {{ site_data_path }}"
copy:
src: "{{ sites_path }}/{{ site.slug }}/homeserver.yaml"
dest: "{{ site_data_path }}/homeserver.yaml"
remote_src: yes
tags: config
- name: "Let synapse generate missing configuration files"
- name: "Let synapse generate missing configuration files"
docker_container:
name: synapse_config_generator
image: "matrixdotorg/synapse:{{ synapse.version }}"
@ -45,18 +45,20 @@
tags: config
############################
# PostgreSQL configuration #
############################
############################
# PostgreSQL configuration #
############################
- name: "Setup PostgreSQL"
- name: "Setup PostgreSQL"
import_tasks: postgres.yml
tags: postgres
#################
# Setup backups #
#################
#################
# Setup backups #
#################
- name: "Setup backups"
- name: "Setup backups"
import_tasks: backup.yml
tags: backup
tags: synapse # / block

View file

@ -1,20 +1,23 @@
---
- name: "Set site_data_path to {{ www_path }}/{{ site.slug }}_wp-content"
- block: # Used for tagging all tasks with "wordpress"
- name: "Set site_data_path to {{ www_path }}/{{ site.slug }}_wp-content"
set_fact: site_data_path="{{ www_path }}/{{ site.slug }}_wp-content"
tags: always
###############################
# Create wp-content if needed #
###############################
###############################
# Create wp-content if needed #
###############################
- name: Is it a new install?
- name: Is it a new install?
stat:
path: "{{ site_data_path }}/index.php"
register: wpcontent
tags: bootstrap
- name: Populate wp-content folder
- name: Populate wp-content folder
block:
- name: "Clear folder {{ site_data_path }}"
file:
@ -60,40 +63,42 @@
tags: bootstrap
####################
# Render templates #
####################
####################
# Render templates #
####################
- name: "Render templates"
- name: "Render templates"
import_tasks: render.yml
tags: render
#######################
# MySQL configuration #
#######################
#######################
# MySQL configuration #
#######################
- name: "Setup MySQL"
- name: "Setup MySQL"
import_tasks: mysql.yml
tags: mysql
#################
# Setup backups #
#################
#################
# Setup backups #
#################
- name: "Setup backups"
- name: "Setup backups"
import_tasks: backup.yml
tags: backup
###################
# SSL certificate #
###################
###################
# SSL certificate #
###################
# - name: Create Let's Encrypt certificate
# This seems hard, see:
# https://docs.ansible.com/ansible/latest/modules/acme_certificate_module.html#acme-certificate-module
# https://www.digitalocean.com/community/tutorials/how-to-acquire-a-let-s-encrypt-certificate-using-ansible-on-ubuntu-18-04
# Maybe using shell directly? e.g.
# certbot certonly --webroot -w /var/www/letsencrypt -d <url>
# - name: Create Let's Encrypt certificate
# This seems hard, see:
# https://docs.ansible.com/ansible/latest/modules/acme_certificate_module.html#acme-certificate-module
# https://www.digitalocean.com/community/tutorials/how-to-acquire-a-let-s-encrypt-certificate-using-ansible-on-ubuntu-18-04
# Maybe using shell directly? e.g.
# certbot certonly --webroot -w /var/www/letsencrypt -d <url>
tags: wordpress # / block

View file

@ -2,10 +2,14 @@
# Needs variables:
# - site: dict describing the site install (cf group_vars/all/vars.yml)
- name: Include nginx tasks
include_tasks: nginx.yml
- block: # Used for tagging all tasks with "drupal"
- name: Include nginx tasks
import_tasks: nginx.yml
tags: nginx
- name: Include docker tasks
include_tasks: docker.yml
- name: Include docker tasks
import_tasks: docker.yml
tags: docker
tags: drupal

View file

@ -2,10 +2,14 @@
# Needs variables:
# - site: dict describing the site install (cf group_vars/all/vars.yml)
- name: Include docker tasks
include_tasks: docker.yml
- block: # Used for tagging all tasks with "gitea"
- name: Include docker tasks
import_tasks: docker.yml
tags: docker
- name: Include nginx tasks
include_tasks: nginx.yml
- name: Include nginx tasks
import_tasks: nginx.yml
tags: nginx
tags: gitea

View file

@ -2,10 +2,14 @@
# Needs variables:
# - site: dict describing the site install (cf group_vars/all/vars.yml)
- name: Include docker tasks
include_tasks: docker.yml
- block: # Used for tagging all tasks with "synapse"
- name: Include docker tasks
import_tasks: docker.yml
tags: docker
- name: Include nginx tasks
include_tasks: nginx.yml
- name: Include nginx tasks
import_tasks: nginx.yml
tags: nginx
tags: synapse

View file

@ -2,10 +2,14 @@
# Needs variables:
# - site: dict describing the site install (cf group_vars/all/vars.yml)
- name: Include nginx tasks
include_tasks: nginx.yml
- block: # Used for tagging all tasks with "wordpress"
- name: Include nginx tasks
import_tasks: nginx.yml
tags: nginx
- name: Include docker tasks
include_tasks: docker.yml
- name: Include docker tasks
import_tasks: docker.yml
tags: docker
tags: wordpress