2017-12-16 16:09:34 +03:00
---
- name : Activate postgres container
docker_container :
name : postgres
state : started
restart_policy : unless-stopped
2018-09-10 23:11:43 +03:00
image : "{{ postgresql_image }}"
2017-12-16 16:09:34 +03:00
volumes :
- "{{ postgres_data_dir }}:/var/lib/postgresql/data:Z"
env :
POSTGRES_USER : "{{ pg_username }}"
POSTGRES_PASSWORD : "{{ pg_password }}"
POSTGRES_DB : "{{ pg_database }}"
PGDATA : "/var/lib/postgresql/data/pgdata"
when : pg_hostname is not defined or pg_hostname == ''
register : postgres_container_activate
- name : Activate rabbitmq container
docker_container :
name : rabbitmq
state : started
restart_policy : unless-stopped
2018-03-28 06:28:16 +03:00
image : "{{ rabbitmq_image }}"
2017-12-16 16:09:34 +03:00
env :
2018-09-10 23:11:43 +03:00
RABBITMQ_DEFAULT_VHOST : "{{ rabbitmq_default_vhost }}"
RABBITMQ_ERLANG_COOKIE : "{{ rabbitmq_erlang_cookie }}"
RABBITMQ_DEFAULT_USER : "{{ rabbitmq_default_username }}"
RABBITMQ_DEFAULT_PASS : "{{ rabbitmq_default_password }}"
2017-12-16 16:09:34 +03:00
register : rabbitmq_container_activate
- name : Activate memcached container
docker_container :
name : memcached
state : started
restart_policy : unless-stopped
image : memcached:alpine
- name : Wait for postgres and rabbitmq to activate
pause :
seconds : 15
when : postgres_container_activate.changed or rabbitmq_container_activate.changed
- name : Set properties without postgres for awx_web
set_fact :
pg_hostname_actual : "{{ pg_hostname }}"
awx_web_container_links :
- rabbitmq
- memcached
when : pg_hostname is defined
- name : Set properties with postgres for awx_web
set_fact :
pg_hostname_actual : postgres
awx_web_container_links :
- rabbitmq
- memcached
- postgres
when : pg_hostname is not defined or pg_hostname == ''
- name : Set properties without postgres for awx_task
set_fact :
pg_hostname_actual : "{{ pg_hostname }}"
awx_task_container_links :
- rabbitmq
- memcached
- awx_web:awxweb
when : pg_hostname is defined
- name : Set properties with postgres for awx_task
set_fact :
pg_hostname_actual : postgres
awx_task_container_links :
- rabbitmq
- memcached
- awx_web:awxweb
- postgres
when : pg_hostname is not defined or pg_hostname == ''
- name : Activate AWX Web Container
docker_container :
name : awx_web
state : started
restart_policy : unless-stopped
image : "{{ awx_web_docker_actual_image }}"
2018-10-12 19:36:05 +03:00
volumes : >
{{
2018-10-15 11:44:07 +03:00
([project_data_dir + ':/var/lib/awx/projects:z'] if project_data_dir is defined else [])
+ ([ca_trust_dir + ':/etc/pki/ca-trust/source/anchors:ro'] if ca_trust_dir is defined else [])
2018-10-12 19:36:05 +03:00
}}
2017-12-16 16:09:34 +03:00
user : root
ports :
- "{{ host_port }}:8052"
links : "{{ awx_web_container_links|list }}"
2018-08-04 11:49:07 +03:00
hostname : "{{ awx_web_hostname }}"
2017-12-16 16:09:34 +03:00
dns_search_domains : "{{ awx_container_search_domains.split(',') if awx_container_search_domains is defined else omit }}"
dns_servers : "{{ awx_alternate_dns_servers.split(',') if awx_alternate_dns_servers is defined else omit }}"
env :
http_proxy : "{{ http_proxy | default('') }}"
https_proxy : "{{ https_proxy | default('') }}"
no_proxy : "{{ no_proxy | default('') }}"
2018-04-12 05:53:20 +03:00
SECRET_KEY : "{{ secret_key }}"
2017-12-16 16:09:34 +03:00
DATABASE_NAME : "{{ pg_database }}"
DATABASE_USER : "{{ pg_username }}"
DATABASE_PASSWORD : "{{ pg_password }}"
DATABASE_PORT : "{{ pg_port }}"
DATABASE_HOST : "{{ pg_hostname_actual }}"
2018-09-10 23:11:43 +03:00
RABBITMQ_USER : "{{ rabbitmq_default_username }}"
RABBITMQ_PASSWORD : "{{ rabbitmq_default_password }}"
2017-12-16 16:09:34 +03:00
RABBITMQ_HOST : "rabbitmq"
2018-09-10 23:11:43 +03:00
RABBITMQ_PORT : "{{ rabbitmq_port }}"
RABBITMQ_VHOST : "{{ rabbitmq_default_vhost }}"
2017-12-16 16:09:34 +03:00
MEMCACHED_HOST : "memcached"
MEMCACHED_PORT : "11211"
2018-10-25 00:40:42 +03:00
AWX_ADMIN_USER : "{{ admin_user|default('admin') }}"
AWX_ADMIN_PASSWORD : "{{ admin_password|default('password') }}"
2018-10-12 12:13:42 +03:00
register : awx_web_container
2018-08-09 15:07:29 +03:00
- name : Update CA trust in awx_web container
command : docker exec awx_web '/usr/bin/update-ca-trust'
when : awx_web_container.changed
2017-12-16 16:09:34 +03:00
- name : Activate AWX Task Container
docker_container :
name : awx_task
state : started
restart_policy : unless-stopped
image : "{{ awx_task_docker_actual_image }}"
2018-03-02 23:43:21 +03:00
volumes : >
{{
2018-10-15 11:44:07 +03:00
([project_data_dir + ':/var/lib/awx/projects:z'] if project_data_dir is defined else [])
+ ([ca_trust_dir + ':/etc/pki/ca-trust/source/anchors:ro'] if ca_trust_dir is defined else [])
2018-03-02 23:43:21 +03:00
}}
2017-12-16 16:09:34 +03:00
links : "{{ awx_task_container_links|list }}"
user : root
2018-08-04 11:49:07 +03:00
hostname : "{{ awx_task_hostname }}"
2017-12-16 16:09:34 +03:00
dns_search_domains : "{{ awx_container_search_domains.split(',') if awx_container_search_domains is defined else omit }}"
dns_servers : "{{ awx_alternate_dns_servers.split(',') if awx_alternate_dns_servers is defined else omit }}"
env :
http_proxy : "{{ http_proxy | default('') }}"
https_proxy : "{{ https_proxy | default('') }}"
no_proxy : "{{ no_proxy | default('') }}"
2018-04-12 05:53:20 +03:00
SECRET_KEY : "{{ secret_key }}"
2017-12-16 16:09:34 +03:00
DATABASE_NAME : "{{ pg_database }}"
DATABASE_USER : "{{ pg_username }}"
DATABASE_PASSWORD : "{{ pg_password }}"
DATABASE_HOST : "{{ pg_hostname_actual }}"
DATABASE_PORT : "{{ pg_port }}"
2018-09-10 23:11:43 +03:00
RABBITMQ_USER : "{{ rabbitmq_default_username }}"
RABBITMQ_PASSWORD : "{{ rabbitmq_default_password }}"
2017-12-16 16:09:34 +03:00
RABBITMQ_HOST : "rabbitmq"
2018-09-10 23:11:43 +03:00
RABBITMQ_PORT : "{{ rabbitmq_port }}"
RABBITMQ_VHOST : "{{ rabbitmq_default_vhost }}"
2017-12-16 16:09:34 +03:00
MEMCACHED_HOST : "memcached"
MEMCACHED_PORT : "11211"
2018-10-25 00:40:42 +03:00
AWX_ADMIN_USER : "{{ admin_user|default('admin') }}"
AWX_ADMIN_PASSWORD : "{{ admin_password|default('password') }}"