summaryrefslogtreecommitdiffstats
path: root/installer
diff options
context:
space:
mode:
authorShane McDonald <me@shanemcd.com>2019-03-27 17:01:10 +0100
committerShane McDonald <me@shanemcd.com>2019-03-27 18:06:55 +0100
commitc3ba851908ab397857aeb6c5f0c0ea16c1f4ee5e (patch)
tree08aea5956d3a9c1e389bcbad9f6347f0bad82184 /installer
parentMerge pull request #3515 from shanemcd/docker-compose-permissions (diff)
downloadawx-c3ba851908ab397857aeb6c5f0c0ea16c1f4ee5e.tar.xz
awx-c3ba851908ab397857aeb6c5f0c0ea16c1f4ee5e.zip
Fix docker-compose installs
In a series of unfortunate events, my patch yesterday didnt actually work. This fixes that.
Diffstat (limited to 'installer')
-rw-r--r--installer/roles/local_docker/defaults/main.yml5
-rw-r--r--installer/roles/local_docker/tasks/compose.yml35
-rw-r--r--installer/roles/local_docker/templates/credentials.py.j23
-rw-r--r--installer/roles/local_docker/templates/docker-compose.yml.j211
-rw-r--r--installer/roles/local_docker/vars/Darwin.yml1
-rw-r--r--installer/roles/local_docker/vars/default.yml1
6 files changed, 23 insertions, 33 deletions
diff --git a/installer/roles/local_docker/defaults/main.yml b/installer/roles/local_docker/defaults/main.yml
index e145e3559a..903de06c73 100644
--- a/installer/roles/local_docker/defaults/main.yml
+++ b/installer/roles/local_docker/defaults/main.yml
@@ -6,9 +6,10 @@ rabbitmq_image: "ansible/awx_rabbitmq:{{rabbitmq_version}}"
rabbitmq_default_vhost: "awx"
rabbitmq_erlang_cookie: "cookiemonster"
rabbitmq_port: "5672"
-rabbitmq_default_username: "guest"
-rabbitmq_default_password: "guest"
+rabbitmq_user: "guest"
+rabbitmq_password: "guest"
postgresql_version: "9.6"
postgresql_image: "postgres:{{postgresql_version}}"
+docker_compose_dir: "/tmp/awxcompose"
diff --git a/installer/roles/local_docker/tasks/compose.yml b/installer/roles/local_docker/tasks/compose.yml
index ab896396aa..0ab8955cec 100644
--- a/installer/roles/local_docker/tasks/compose.yml
+++ b/installer/roles/local_docker/tasks/compose.yml
@@ -1,37 +1,20 @@
---
-- include_vars: '{{ item }}'
- with_first_found:
- - files:
- - '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml' # CentOS-7
- - '{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml' # RedHat-7
- - '{{ ansible_distribution }}.yml' # CentOS
- - '{{ ansible_os_family }}.yml' # RedHat
- - 'default.yml'
-
- name: Create {{ docker_compose_dir }} directory
file:
path: "{{ docker_compose_dir }}"
state: directory
-- name: Create docker-compose.yml file
+- name: Create Docker Compose Configuration
template:
- src: docker-compose.yml.j2
- dest: "{{ docker_compose_dir }}/docker-compose.yml"
+ src: "{{ item }}.j2"
+ dest: "{{ docker_compose_dir }}/{{ item }}"
mode: 0600
+ with_items:
+ - environment.sh
+ - credentials.py
+ - docker-compose.yml
register: awx_compose_config
-- name: Render secrets file
- template:
- src: environment.sh.j2
- dest: "{{ docker_compose_dir }}/environment.sh"
- mode: 0600
-
-- name: Render application credentials
- template:
- src: credentials.py.j2
- dest: "{{ docker_compose_dir }}/credentials.py"
- mode: 0600
-
- name: Render SECRET_KEY file
copy:
content: "{{ secret_key }}"
@@ -44,9 +27,9 @@
register: awx_compose_start
- name: Update CA trust in awx_web container
- command: docker exec awx_web_1 '/usr/bin/update-ca-trust'
+ command: docker exec awx_web '/usr/bin/update-ca-trust'
when: awx_compose_config.changed or awx_compose_start.changed
- name: Update CA trust in awx_task container
- command: docker exec awx_task_1 '/usr/bin/update-ca-trust'
+ command: docker exec awx_task '/usr/bin/update-ca-trust'
when: awx_compose_config.changed or awx_compose_start.changed
diff --git a/installer/roles/local_docker/templates/credentials.py.j2 b/installer/roles/local_docker/templates/credentials.py.j2
index 70c3f64bfa..b7907fa462 100644
--- a/installer/roles/local_docker/templates/credentials.py.j2
+++ b/installer/roles/local_docker/templates/credentials.py.j2
@@ -12,9 +12,10 @@ DATABASES = {
BROKER_URL = 'amqp://{}:{}@{}:{}/{}'.format(
"{{ rabbitmq_user }}",
"{{ rabbitmq_password }}",
- "localhost",
+ "rabbitmq",
"5672",
"awx")
+
CHANNEL_LAYERS = {
'default': {'BACKEND': 'asgi_amqp.AMQPChannelLayer',
'ROUTING': 'awx.main.routing.channel_routing',
diff --git a/installer/roles/local_docker/templates/docker-compose.yml.j2 b/installer/roles/local_docker/templates/docker-compose.yml.j2
index 29354dafe5..138d0e9871 100644
--- a/installer/roles/local_docker/templates/docker-compose.yml.j2
+++ b/installer/roles/local_docker/templates/docker-compose.yml.j2
@@ -4,6 +4,7 @@ services:
web:
image: {{ awx_web_docker_actual_image }}
+ container_name: awx_web
depends_on:
- rabbitmq
- memcached
@@ -50,6 +51,7 @@ services:
task:
image: {{ awx_task_docker_actual_image }}
+ container_name: awx_task
depends_on:
- rabbitmq
- memcached
@@ -95,18 +97,23 @@ services:
rabbitmq:
image: {{ rabbitmq_image }}
+ container_name: awx_rabbitmq
restart: unless-stopped
environment:
- RABBITMQ_DEFAULT_VHOST: awx
- RABBITMQ_ERLANG_COOKIE: cookiemonster
+ RABBITMQ_DEFAULT_VHOST: "{{ rabbitmq_default_vhost }}"
+ RABBITMQ_DEFAULT_USER: "{{ rabbitmq_user }}"
+ RABBITMQ_DEFAULT_PASS: "{{ rabbitmq_password }}"
+ RABBITMQ_ERLANG_COOKIE: {{ rabbitmq_erlang_cookie }}
memcached:
image: memcached:alpine
+ container_name: awx_memcached
restart: unless-stopped
{% if pg_hostname is not defined %}
postgres:
image: postgres:9.6
+ container_name: awx_postgres
restart: unless-stopped
volumes:
- {{ postgres_data_dir }}:/var/lib/postgresql/data:Z
diff --git a/installer/roles/local_docker/vars/Darwin.yml b/installer/roles/local_docker/vars/Darwin.yml
deleted file mode 100644
index 168547c338..0000000000
--- a/installer/roles/local_docker/vars/Darwin.yml
+++ /dev/null
@@ -1 +0,0 @@
-docker_compose_dir: "/usr/local/var/lib/awx"
diff --git a/installer/roles/local_docker/vars/default.yml b/installer/roles/local_docker/vars/default.yml
deleted file mode 100644
index 56676b99d7..0000000000
--- a/installer/roles/local_docker/vars/default.yml
+++ /dev/null
@@ -1 +0,0 @@
-docker_compose_dir: "/var/lib/awx"