ansible creates docker-compose
This commit is contained in:
parent
ab4e139adc
commit
804c7ae65d
4 changed files with 87 additions and 0 deletions
1
wordpress/ansible-playbook.retry
Normal file
1
wordpress/ansible-playbook.retry
Normal file
|
@ -0,0 +1 @@
|
|||
localhost
|
41
wordpress/ansible-playbook.yml
Normal file
41
wordpress/ansible-playbook.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
---
|
||||
- hosts: localhost
|
||||
# ask_pass: yes
|
||||
gather_facts: no
|
||||
|
||||
vars:
|
||||
# short site name to use as dir/file name
|
||||
site_name: lexperimental
|
||||
site_url: lexperimental.fr
|
||||
docker_image: wordpress:apache
|
||||
docker_volumes:
|
||||
- "/var/www/arvuhez/wp-content/:/var/www/html/wp-content"
|
||||
mysql_database: lexperimental
|
||||
mysql_username: lexperimental
|
||||
mysql_password: "azlhqsdh"
|
||||
subnet_cidr_address: 172.100.0.0/24
|
||||
subnet_gateway_ip: 172.100.0.1
|
||||
subnet_site_ip: 172.100.0.2
|
||||
|
||||
|
||||
|
||||
|
||||
tasks:
|
||||
- name: "Create target directory {{ site_name }}"
|
||||
file:
|
||||
name: "{{ site_name }}"
|
||||
state: directory
|
||||
- name: Generate a docker-compose.yml file for our site
|
||||
template:
|
||||
src: templates/docker-compose.yml.j2
|
||||
dest: "{{ site_name }}/docker-compose.yml"
|
||||
# - debug: "Do the MySQL users thingy"
|
||||
#- name: Generate a new nginx server config file
|
||||
#- template:
|
||||
#- src: templates/site.conf.j2
|
||||
#- dest: "/etc/nginx/sites-available/{{ site_url }}"
|
||||
# become: yes
|
||||
# - debug: "Now do `ln -s /etc/nginx/sites-available/{{ site_url }} /etc/nginx/sites-enabled/"
|
||||
|
||||
|
||||
|
23
wordpress/lexperimental/docker-compose.yml
Normal file
23
wordpress/lexperimental/docker-compose.yml
Normal file
|
@ -0,0 +1,23 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
wp:
|
||||
image: wordpress:apache
|
||||
restart: always
|
||||
environment:
|
||||
WORDPRESS_DB_HOST: "172.100.0.1"
|
||||
WORDPRESS_DB_USER: "lexperimental"
|
||||
WORDPRESS_DB_PASSWORD: "azlhqsdh"
|
||||
WORDPRESS_DB_NAME: "lexperimental"
|
||||
volumes: ['/var/www/arvuhez/wp-content/:/var/www/html/wp-content']
|
||||
|
||||
networks:
|
||||
net:
|
||||
ipv4_address: "172.100.0.2"
|
||||
|
||||
networks:
|
||||
net:
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: "172.100.0.0/24"
|
22
wordpress/templates/docker-compose.yml.j2
Normal file
22
wordpress/templates/docker-compose.yml.j2
Normal file
|
@ -0,0 +1,22 @@
|
|||
version: '3'
|
||||
|
||||
services:
|
||||
wp:
|
||||
image: {{ docker_image }}
|
||||
restart: always
|
||||
environment:
|
||||
WORDPRESS_DB_HOST: "{{ subnet_gateway_ip }}"
|
||||
WORDPRESS_DB_USER: "{{ mysql_username }}"
|
||||
WORDPRESS_DB_PASSWORD: "{{ mysql_password }}"
|
||||
WORDPRESS_DB_NAME: "{{ mysql_database }}"
|
||||
volumes: {{ docker_volumes | to_yaml }}
|
||||
networks:
|
||||
net:
|
||||
ipv4_address: "{{ subnet_site_ip }}"
|
||||
|
||||
networks:
|
||||
net:
|
||||
ipam:
|
||||
driver: default
|
||||
config:
|
||||
- subnet: "{{ subnet_cidr_address }}"
|
Loading…
Reference in a new issue