From a43b038b68754eaa15ebe24de95d827eb81c677e Mon Sep 17 00:00:00 2001 From: Kris Lamoureux Date: Sat, 2 Nov 2019 23:34:03 -0400 Subject: [PATCH] Added more defaults --- roles/docker/defaults/main.yml | 1 + roles/docker/tasks/main.yml | 3 ++- roles/traefik/defaults/main.yml | 1 + roles/traefik/tasks/main.yml | 2 +- roles/wordpress/defaults/main.yml | 6 ++++++ roles/wordpress/tasks/main.yml | 22 +++++++++++----------- 6 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 roles/docker/defaults/main.yml create mode 100644 roles/wordpress/defaults/main.yml diff --git a/roles/docker/defaults/main.yml b/roles/docker/defaults/main.yml new file mode 100644 index 0000000..7278ac6 --- /dev/null +++ b/roles/docker/defaults/main.yml @@ -0,0 +1 @@ +docker_user: vagrant diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index 0e14e00..c79f83f 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -43,8 +43,9 @@ - name: Add user to docker group user: - name: vagrant + name: "{{ docker_user }}" groups: docker + append: yes - name: Install docker-compose script: install-compose.sh diff --git a/roles/traefik/defaults/main.yml b/roles/traefik/defaults/main.yml index 9ec3f9d..b3ef50f 100644 --- a/roles/traefik/defaults/main.yml +++ b/roles/traefik/defaults/main.yml @@ -1,3 +1,4 @@ +traefik_name: traefik traefik_version: latest traefik_port: 8000 traefik_admin_port: 8080 diff --git a/roles/traefik/tasks/main.yml b/roles/traefik/tasks/main.yml index 3aaf396..2f05fae 100644 --- a/roles/traefik/tasks/main.yml +++ b/roles/traefik/tasks/main.yml @@ -5,7 +5,7 @@ - name: Start Traefik container docker_container: - name: traefik + name: "{{ traefik_name }}" image: traefik:{{ traefik_version }} restart_policy: always ports: diff --git a/roles/wordpress/defaults/main.yml b/roles/wordpress/defaults/main.yml new file mode 100644 index 0000000..f490576 --- /dev/null +++ b/roles/wordpress/defaults/main.yml @@ -0,0 +1,6 @@ +mariadb_name: mariadb +mariadb_version: latest + +wordpress_version: latest +wordpress_dbname: wordpress +wordpress_dbuser: wordpress diff --git a/roles/wordpress/tasks/main.yml b/roles/wordpress/tasks/main.yml index 8f08f57..2005569 100644 --- a/roles/wordpress/tasks/main.yml +++ b/roles/wordpress/tasks/main.yml @@ -1,25 +1,25 @@ - name: Start MariaDB container docker_container: - name: mariadb - image: mariadb:10.4.8 + name: "{{ mariadb_name }}" + image: mariadb:{{ mariadb_version }} restart_policy: always volumes: mariadb:/var/lib/mysql env: MYSQL_RANDOM_ROOT_PASSWORD: "true" - MYSQL_DATABASE: wordpress - MYSQL_USER: wordpress - MYSQL_PASSWORD: Password1 + MYSQL_DATABASE: "{{ wordpress_dbname }}" + MYSQL_USER: "{{ wordpress_dbuser }}" + MYSQL_PASSWORD: "{{ wordpress_dbpass }}" - name: Start WordPress container docker_container: name: wordpress - image: wordpress:5.2.3 + image: wordpress:{{ wordpress_version }} restart_policy: always volumes: wordpress:/var/www/html links: - - mariadb + - "{{ mariadb_name }}" env: - WORDPRESS_DB_NAME: wordpress - WORDPRESS_DB_USER: wordpress - WORDPRESS_DB_PASSWORD: Password1 - WORDPRESS_DB_HOST: mariadb + WORDPRESS_DB_NAME: "{{ wordpress_dbname }}" + WORDPRESS_DB_USER: "{{ wordpress_dbuser }}" + WORDPRESS_DB_PASSWORD: "{{ wordpress_dbpass }}" + WORDPRESS_DB_HOST: "{{ mariadb_name }}"