63 lines
1.6 KiB
YAML
63 lines
1.6 KiB
YAML
---
|
|
- name: Install and configure Wordpress
|
|
hosts: web
|
|
become : True
|
|
collections:
|
|
- chrissayon.wordpress_docker
|
|
|
|
roles:
|
|
- geerlingguy.docker
|
|
- chrissayon.wordpress_docker.network
|
|
- chrissayon.wordpress_docker.mysql
|
|
- chrissayon.wordpress_docker.wordpress
|
|
|
|
|
|
tasks:
|
|
# Need to stop using port 80 for certbot webroot validation
|
|
- name: Gathering NGINX container state
|
|
docker_container_info:
|
|
name: nginx
|
|
register: nginx_info
|
|
|
|
- name: Stop NGINX if present
|
|
docker_container:
|
|
name: nginx
|
|
state: stopped
|
|
when:
|
|
- nginx_info.exists
|
|
|
|
# Manage certbot
|
|
|
|
- name: Install / configure certbot
|
|
include_role:
|
|
name: geerlingguy.certbot
|
|
|
|
# Copy certificates
|
|
# configured volume for ssl is
|
|
# "/usr/data/wp/nginx/ssl:/etc/nginx/ssl/:ro"
|
|
|
|
- name: Copy fullchain files to nginx volume
|
|
ansible.builtin.copy:
|
|
src: "/etc/letsencrypt/live/{{ item.name }}/fullchain.pem"
|
|
#TODO nginx configuration is not multi domain
|
|
dest: "{{ docker_base_volume_path }}/nginx/ssl/fullchain.pem"
|
|
remote_src: true
|
|
mode: '0644'
|
|
loop: "{{ certbot_certs }}"
|
|
|
|
- name: Copy privkey files to nginx volume
|
|
ansible.builtin.copy:
|
|
src: "/etc/letsencrypt/live/{{ item.name }}/privkey.pem"
|
|
#TODO nginx configuration is not multi domain
|
|
dest: "{{ docker_base_volume_path }}/nginx/ssl/privatekey.pem"
|
|
remote_src: true
|
|
mode: '0644'
|
|
loop: "{{ certbot_certs }}"
|
|
|
|
|
|
# Restart NGINX
|
|
|
|
- name: (Re)start NGINX
|
|
include_role:
|
|
name: chrissayon.wordpress_docker.nginx
|