mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 18:40:01 -03:30
Merge pull request #856 from ewjoachim/docker-compose-491
Fixes #491: Adding Docker Compose installer
This commit is contained in:
commit
d4983ea10d
40
INSTALL.md
40
INSTALL.md
@ -26,7 +26,7 @@ This document provides a guide for installing AWX.
|
||||
- [Start the build](#start-the-build-1)
|
||||
- [Accessing AWX](#accessing-awx-1)
|
||||
- [SSL Termination](#ssl-termination)
|
||||
- [Docker](#docker)
|
||||
- [Docker and Docker Compose](#docker-and-docker-compose)
|
||||
- [Prerequisites](#prerequisites-3)
|
||||
- [Pre-build steps](#pre-build-steps-2)
|
||||
- [Deploying to a remote host](#deploying-to-a-remote-host)
|
||||
@ -77,11 +77,14 @@ The system that runs the AWX service will need to satisfy the following requirem
|
||||
|
||||
### Choose a deployment platform
|
||||
|
||||
We currently support running AWX as a containerized application using Docker images deployed to either an OpenShift cluster, or a standalone Docker daemon. The remainder of this document will walk you through the process of building the images, and deploying them to either platform.
|
||||
We currently support running AWX as a containerized application using Docker images deployed to either an OpenShift cluster, docker-compose or a standalone Docker daemon. The remainder of this document will walk you through the process of building the images, and deploying them to either platform.
|
||||
|
||||
The [installer](./installer) directory contains an [inventory](./installer/inventory) file, and a playbook, [install.yml](./installer/install.yml). You'll begin by setting variables in the inventory file according to the platform you wish to use, and then you'll start the image build and deployment process by running the playbook.
|
||||
|
||||
In the sections below, you'll find deployment details and instructions for each platform. To deploy to Docker, view the [Docker section](#docker), for OpenShift, view the [OpenShift section](#openshift), for Kubernetes, view the [Kubernetes section](#kubernetes).
|
||||
In the sections below, you'll find deployment details and instructions for each platform:
|
||||
- [Docker and Docker Compose](#docker-and-docker-compose)
|
||||
- [OpenShift](#openshift)
|
||||
- [Kubernetes](#kubernetes).
|
||||
|
||||
### Official vs Building Images
|
||||
|
||||
@ -346,16 +349,15 @@ If your provider is able to allocate an IP Address from the Ingress controller t
|
||||
|
||||
Unlike Openshift's `Route` the Kubernetes `Ingress` doesn't yet handle SSL termination. As such the default configuration will only expose AWX through HTTP on port 80. You are responsible for configuring SSL support until support is added (either to Kubernetes or AWX itself).
|
||||
|
||||
## Docker
|
||||
|
||||
## Docker or Docker-Compose
|
||||
|
||||
### Prerequisites
|
||||
|
||||
You will need the following installed on the host where AWX will be deployed:
|
||||
- [Docker](https://docs.docker.com/engine/installation/) on the host where AWX will be deployed. After installing Docker, the Docker service must be started (depending on your OS, you may have to add the local user that uses Docker to the ``docker`` group, refer to the documentation for details)
|
||||
- [docker-py](https://github.com/docker/docker-py) Python module.
|
||||
|
||||
- [Docker](https://docs.docker.com/engine/installation/)
|
||||
- [docker-py](https://github.com/docker/docker-py) Python module
|
||||
|
||||
Note: After installing Docker, the Docker service must be started.
|
||||
If you're installing using Docker Compose, you'll need [Docker Compose](https://docs.docker.com/compose/install/).
|
||||
|
||||
### Pre-build steps
|
||||
|
||||
@ -398,6 +400,13 @@ Before starting the build process, review the [inventory](./installer/inventory)
|
||||
|
||||
> Provide a port number that can be mapped from the Docker daemon host to the web server running inside the AWX container. Defaults to *80*.
|
||||
|
||||
*use_docker_compose*
|
||||
|
||||
> Switch to ``true`` to use Docker Compose instead of the standalone Docker install.
|
||||
|
||||
*docker_compose_dir*
|
||||
|
||||
When using docker-compose, the `docker-compose.yml` file will be created there (default `/var/lib/awx`).
|
||||
|
||||
#### Docker registry
|
||||
|
||||
@ -479,6 +488,8 @@ e240ed8209cd awx_task:1.0.0.8 "/tini -- /bin/sh ..." 2 minutes ago
|
||||
97e196120ab3 postgres:9.6 "docker-entrypoint..." 2 minutes ago Up 2 minutes 5432/tcp postgres
|
||||
```
|
||||
|
||||
If you're deploying using Docker Compose, container names will be prefixed by the name of the folder where the docker-compose.yml file is created (by default, `awx`).
|
||||
|
||||
Immediately after the containers start, the *awx_task* container will perform required setup tasks, including database migrations. These tasks need to complete before the web interface can be accessed. To monitor the progress, you can follow the container's STDOUT by running the following:
|
||||
|
||||
```bash
|
||||
@ -541,3 +552,14 @@ Added instance awx to tower
|
||||
The AWX web server is accessible on the deployment host, using the *host_port* value set in the *inventory* file. The default URL is [http://localhost](http://localhost).
|
||||
|
||||
You will prompted with a login dialog. The default administrator username is `admin`, and the password is `password`.
|
||||
|
||||
### Maintenance using docker-compose
|
||||
|
||||
After the installation, maintenance operations with docker-compose can be done by using the `docker-compose.yml` file created at the location pointed by `docker_compose_dir`.
|
||||
|
||||
Among the possible operations, you may:
|
||||
|
||||
- Stop AWX : `docker-compose stop`
|
||||
- Upgrade AWX : `docker-compose pull && docker-compose up --force-recreate`
|
||||
|
||||
See the [docker-compose documentation](https://docs.docker.com/compose/) for details.
|
||||
|
||||
@ -30,7 +30,7 @@ awx_secret_key=awxsecret
|
||||
# kubernetes_context=test-cluster
|
||||
# awx_kubernetes_namespace=awx
|
||||
|
||||
# Standalone Docker Install
|
||||
# Common Docker parameters
|
||||
postgres_data_dir=/tmp/pgdocker
|
||||
host_port=80
|
||||
|
||||
@ -38,11 +38,19 @@ host_port=80
|
||||
# Optional for Openshift if using Dockerhub or another prebuilt registry
|
||||
# Required for Standalone Docker Install if building the image on your own
|
||||
# Optional for Standalone Docker Install if using Dockerhub or another prebuilt registry
|
||||
# Required for Docker Compose Install if building the image on your own
|
||||
# Optional for Docker Compose Install if using Dockerhub or another prebuilt registry
|
||||
# Define if you want the image pushed to a registry. The container definition will also use these images
|
||||
# docker_registry=172.30.1.1:5000
|
||||
# docker_registry_repository=awx
|
||||
# docker_registry_username=developer
|
||||
|
||||
# Docker Compose Install
|
||||
# use_docker_compose=false
|
||||
# The docker_compose.yml file will be created in this directory
|
||||
# The name of the directory (here "awx") will be the prefix of the docker containers
|
||||
docker_compose_dir=/var/lib/awx
|
||||
|
||||
|
||||
# Docker_image will not attempt to push to remote if the image already exists locally
|
||||
# Set this to true to delete images from docker on the build host so that they are pushed to the remote repository
|
||||
|
||||
14
installer/local_docker/tasks/compose.yml
Normal file
14
installer/local_docker/tasks/compose.yml
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
- name: Create {{ docker_compose_dir }} directory
|
||||
file:
|
||||
path: "{{ docker_compose_dir }}"
|
||||
state: directory
|
||||
|
||||
- name: Create docker-compose.yml file
|
||||
template:
|
||||
src: docker-compose.yml.j2
|
||||
dest: "{{ docker_compose_dir }}/docker-compose.yml"
|
||||
|
||||
- name: Start the containers
|
||||
docker_service:
|
||||
project_src: "{{ docker_compose_dir }}"
|
||||
@ -1,221 +1,7 @@
|
||||
---
|
||||
- name: Manage AWX Container Images
|
||||
block:
|
||||
- name: Export Docker web image if it isnt local and there isnt a registry defined
|
||||
docker_image:
|
||||
name: "{{ awx_web_image }}"
|
||||
tag: "{{ awx_version }}"
|
||||
archive_path: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_web_image }}_{{ awx_version }}.tar"
|
||||
when: inventory_hostname != "localhost" and docker_registry is not defined
|
||||
delegate_to: localhost
|
||||
- import_tasks: set_image.yml
|
||||
|
||||
- name: Export Docker task image if it isnt local and there isnt a registry defined
|
||||
docker_image:
|
||||
name: "{{ awx_task_image }}"
|
||||
tag: "{{ awx_version }}"
|
||||
archive_path: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_task_image }}_{{ awx_version }}.tar"
|
||||
when: inventory_hostname != "localhost" and docker_registry is not defined
|
||||
delegate_to: localhost
|
||||
- import_tasks: standalone.yml
|
||||
when: not (use_docker_compose | default(False) | bool)
|
||||
|
||||
- name: Authenticate with Docker registry if registry password given
|
||||
docker_login:
|
||||
registry: "{{ docker_registry }}"
|
||||
username: "{{ docker_registry_username }}"
|
||||
password: "{{ docker_registry_password }}"
|
||||
reauthorize: yes
|
||||
when: docker_registry is defined and docker_registry_password is defined
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Set docker base path
|
||||
set_fact:
|
||||
docker_deploy_base_path: "{{ awx_base_path|default('/tmp') }}/docker_deploy"
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- name: Ensure directory exists
|
||||
file:
|
||||
path: "{{ docker_deploy_base_path }}"
|
||||
state: directory
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- name: Copy web image to docker execution
|
||||
copy:
|
||||
src: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_web_image }}_{{ awx_version }}.tar"
|
||||
dest: "{{ docker_deploy_base_path }}/{{ awx_web_image }}_{{ awx_version }}.tar"
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- name: Copy task image to docker execution
|
||||
copy:
|
||||
src: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_task_image }}_{{ awx_version }}.tar"
|
||||
dest: "{{ docker_deploy_base_path }}"
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- name: Load web image
|
||||
docker_image:
|
||||
name: "{{ awx_web_image }}"
|
||||
tag: "{{ awx_version }}"
|
||||
load_path: "{{ docker_deploy_base_path }}/{{ awx_web_image }}_{{ awx_version }}.tar"
|
||||
timeout: 300
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- name: Load task image
|
||||
docker_image:
|
||||
name: "{{ awx_task_image }}"
|
||||
tag: "{{ awx_version }}"
|
||||
load_path: "{{ docker_deploy_base_path }}/{{ awx_task_image }}_{{ awx_version }}.tar"
|
||||
timeout: 300
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- include_role:
|
||||
name: image_push
|
||||
when: docker_registry is defined and dockerhub_base is not defined
|
||||
|
||||
- name: Set full image path for local install
|
||||
set_fact:
|
||||
awx_web_docker_actual_image: "{{ awx_web_image }}:{{ awx_version }}"
|
||||
awx_task_docker_actual_image: "{{ awx_task_image }}:{{ awx_version }}"
|
||||
when: docker_registry is not defined
|
||||
when: dockerhub_base is not defined
|
||||
|
||||
- name: Set DockerHub Image Paths
|
||||
set_fact:
|
||||
awx_web_docker_actual_image: "{{ dockerhub_base }}/awx_web:{{ dockerhub_version }}"
|
||||
awx_task_docker_actual_image: "{{ dockerhub_base }}/awx_task:{{ dockerhub_version }}"
|
||||
when: dockerhub_base is defined
|
||||
|
||||
- name: Activate postgres container
|
||||
docker_container:
|
||||
name: postgres
|
||||
state: started
|
||||
restart_policy: unless-stopped
|
||||
image: postgres:9.6
|
||||
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
|
||||
image: rabbitmq:3
|
||||
env:
|
||||
RABBITMQ_DEFAULT_VHOST: "awx"
|
||||
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 }}"
|
||||
user: root
|
||||
ports:
|
||||
- "{{ host_port }}:8052"
|
||||
links: "{{ awx_web_container_links|list }}"
|
||||
hostname: awxweb
|
||||
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('') }}"
|
||||
SECRET_KEY: "{{ awx_secret_key }}"
|
||||
DATABASE_NAME: "{{ pg_database }}"
|
||||
DATABASE_USER: "{{ pg_username }}"
|
||||
DATABASE_PASSWORD: "{{ pg_password }}"
|
||||
DATABASE_PORT: "{{ pg_port }}"
|
||||
DATABASE_HOST: "{{ pg_hostname_actual }}"
|
||||
RABBITMQ_USER: "guest"
|
||||
RABBITMQ_PASSWORD: "guest"
|
||||
RABBITMQ_HOST: "rabbitmq"
|
||||
RABBITMQ_PORT: "5672"
|
||||
RABBITMQ_VHOST: "awx"
|
||||
MEMCACHED_HOST: "memcached"
|
||||
MEMCACHED_PORT: "11211"
|
||||
AWX_ADMIN_USER: "{{ default_admin_user|default('admin') }}"
|
||||
AWX_ADMIN_PASSWORD: "{{ default_admin_password|default('password') }}"
|
||||
|
||||
- name: Activate AWX Task Container
|
||||
docker_container:
|
||||
name: awx_task
|
||||
state: started
|
||||
restart_policy: unless-stopped
|
||||
image: "{{ awx_task_docker_actual_image }}"
|
||||
links: "{{ awx_task_container_links|list }}"
|
||||
user: root
|
||||
hostname: awx
|
||||
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('') }}"
|
||||
SECRET_KEY: "{{ awx_secret_key }}"
|
||||
DATABASE_NAME: "{{ pg_database }}"
|
||||
DATABASE_USER: "{{ pg_username }}"
|
||||
DATABASE_PASSWORD: "{{ pg_password }}"
|
||||
DATABASE_HOST: "{{ pg_hostname_actual }}"
|
||||
DATABASE_PORT: "{{ pg_port }}"
|
||||
RABBITMQ_USER: "guest"
|
||||
RABBITMQ_PASSWORD: "guest"
|
||||
RABBITMQ_HOST: "rabbitmq"
|
||||
RABBITMQ_PORT: "5672"
|
||||
RABBITMQ_VHOST: "awx"
|
||||
MEMCACHED_HOST: "memcached"
|
||||
MEMCACHED_PORT: "11211"
|
||||
AWX_ADMIN_USER: "{{ default_admin_user|default('admin') }}"
|
||||
AWX_ADMIN_PASSWORD: "{{ default_admin_password|default('password') }}"
|
||||
- import_tasks: compose.yml
|
||||
when: use_docker_compose | default(False) | bool
|
||||
|
||||
83
installer/local_docker/tasks/set_image.yml
Normal file
83
installer/local_docker/tasks/set_image.yml
Normal file
@ -0,0 +1,83 @@
|
||||
---
|
||||
- name: Manage AWX Container Images
|
||||
block:
|
||||
- name: Export Docker web image if it isnt local and there isnt a registry defined
|
||||
docker_image:
|
||||
name: "{{ awx_web_image }}"
|
||||
tag: "{{ awx_version }}"
|
||||
archive_path: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_web_image }}_{{ awx_version }}.tar"
|
||||
when: inventory_hostname != "localhost" and docker_registry is not defined
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Export Docker task image if it isnt local and there isnt a registry defined
|
||||
docker_image:
|
||||
name: "{{ awx_task_image }}"
|
||||
tag: "{{ awx_version }}"
|
||||
archive_path: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_task_image }}_{{ awx_version }}.tar"
|
||||
when: inventory_hostname != "localhost" and docker_registry is not defined
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Authenticate with Docker registry if registry password given
|
||||
docker_login:
|
||||
registry: "{{ docker_registry }}"
|
||||
username: "{{ docker_registry_username }}"
|
||||
password: "{{ docker_registry_password }}"
|
||||
reauthorize: yes
|
||||
when: docker_registry is defined and docker_registry_password is defined
|
||||
delegate_to: localhost
|
||||
|
||||
- name: Set docker base path
|
||||
set_fact:
|
||||
docker_deploy_base_path: "{{ awx_base_path|default('/tmp') }}/docker_deploy"
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- name: Ensure directory exists
|
||||
file:
|
||||
path: "{{ docker_deploy_base_path }}"
|
||||
state: directory
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- name: Copy web image to docker execution
|
||||
copy:
|
||||
src: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_web_image }}_{{ awx_version }}.tar"
|
||||
dest: "{{ docker_deploy_base_path }}/{{ awx_web_image }}_{{ awx_version }}.tar"
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- name: Copy task image to docker execution
|
||||
copy:
|
||||
src: "{{ awx_local_base_config_path|default('/tmp') }}/{{ awx_task_image }}_{{ awx_version }}.tar"
|
||||
dest: "{{ docker_deploy_base_path }}"
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- name: Load web image
|
||||
docker_image:
|
||||
name: "{{ awx_web_image }}"
|
||||
tag: "{{ awx_version }}"
|
||||
load_path: "{{ docker_deploy_base_path }}/{{ awx_web_image }}_{{ awx_version }}.tar"
|
||||
timeout: 300
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- name: Load task image
|
||||
docker_image:
|
||||
name: "{{ awx_task_image }}"
|
||||
tag: "{{ awx_version }}"
|
||||
load_path: "{{ docker_deploy_base_path }}/{{ awx_task_image }}_{{ awx_version }}.tar"
|
||||
timeout: 300
|
||||
when: ansible_connection != "local" and docker_registry is not defined
|
||||
|
||||
- include_role:
|
||||
name: image_push
|
||||
when: docker_registry is defined and dockerhub_base is not defined
|
||||
|
||||
- name: Set full image path for local install
|
||||
set_fact:
|
||||
awx_web_docker_actual_image: "{{ awx_web_image }}:{{ awx_version }}"
|
||||
awx_task_docker_actual_image: "{{ awx_task_image }}:{{ awx_version }}"
|
||||
when: docker_registry is not defined
|
||||
when: dockerhub_base is not defined
|
||||
|
||||
- name: Set DockerHub Image Paths
|
||||
set_fact:
|
||||
awx_web_docker_actual_image: "{{ dockerhub_base }}/awx_web:{{ dockerhub_version }}"
|
||||
awx_task_docker_actual_image: "{{ dockerhub_base }}/awx_task:{{ dockerhub_version }}"
|
||||
when: dockerhub_base is defined
|
||||
138
installer/local_docker/tasks/standalone.yml
Normal file
138
installer/local_docker/tasks/standalone.yml
Normal file
@ -0,0 +1,138 @@
|
||||
---
|
||||
- name: Activate postgres container
|
||||
docker_container:
|
||||
name: postgres
|
||||
state: started
|
||||
restart_policy: unless-stopped
|
||||
image: postgres:9.6
|
||||
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
|
||||
image: rabbitmq:3
|
||||
env:
|
||||
RABBITMQ_DEFAULT_VHOST: "awx"
|
||||
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 }}"
|
||||
user: root
|
||||
ports:
|
||||
- "{{ host_port }}:8052"
|
||||
links: "{{ awx_web_container_links|list }}"
|
||||
hostname: awxweb
|
||||
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('') }}"
|
||||
SECRET_KEY: "{{ awx_secret_key }}"
|
||||
DATABASE_NAME: "{{ pg_database }}"
|
||||
DATABASE_USER: "{{ pg_username }}"
|
||||
DATABASE_PASSWORD: "{{ pg_password }}"
|
||||
DATABASE_PORT: "{{ pg_port }}"
|
||||
DATABASE_HOST: "{{ pg_hostname_actual }}"
|
||||
RABBITMQ_USER: "guest"
|
||||
RABBITMQ_PASSWORD: "guest"
|
||||
RABBITMQ_HOST: "rabbitmq"
|
||||
RABBITMQ_PORT: "5672"
|
||||
RABBITMQ_VHOST: "awx"
|
||||
MEMCACHED_HOST: "memcached"
|
||||
MEMCACHED_PORT: "11211"
|
||||
AWX_ADMIN_USER: "{{ default_admin_user|default('admin') }}"
|
||||
AWX_ADMIN_PASSWORD: "{{ default_admin_password|default('password') }}"
|
||||
|
||||
- name: Activate AWX Task Container
|
||||
docker_container:
|
||||
name: awx_task
|
||||
state: started
|
||||
restart_policy: unless-stopped
|
||||
image: "{{ awx_task_docker_actual_image }}"
|
||||
links: "{{ awx_task_container_links|list }}"
|
||||
user: root
|
||||
hostname: awx
|
||||
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('') }}"
|
||||
SECRET_KEY: "{{ awx_secret_key }}"
|
||||
DATABASE_NAME: "{{ pg_database }}"
|
||||
DATABASE_USER: "{{ pg_username }}"
|
||||
DATABASE_PASSWORD: "{{ pg_password }}"
|
||||
DATABASE_HOST: "{{ pg_hostname_actual }}"
|
||||
DATABASE_PORT: "{{ pg_port }}"
|
||||
RABBITMQ_USER: "guest"
|
||||
RABBITMQ_PASSWORD: "guest"
|
||||
RABBITMQ_HOST: "rabbitmq"
|
||||
RABBITMQ_PORT: "5672"
|
||||
RABBITMQ_VHOST: "awx"
|
||||
MEMCACHED_HOST: "memcached"
|
||||
MEMCACHED_PORT: "11211"
|
||||
AWX_ADMIN_USER: "{{ default_admin_user|default('admin') }}"
|
||||
AWX_ADMIN_PASSWORD: "{{ default_admin_password|default('password') }}"
|
||||
103
installer/local_docker/templates/docker-compose.yml.j2
Normal file
103
installer/local_docker/templates/docker-compose.yml.j2
Normal file
@ -0,0 +1,103 @@
|
||||
#jinja2: lstrip_blocks: True
|
||||
version: '2'
|
||||
services:
|
||||
|
||||
web:
|
||||
image: {{ awx_web_docker_actual_image }}
|
||||
depends_on:
|
||||
- rabbitmq
|
||||
- memcached
|
||||
{% if pg_hostname is not defined %}
|
||||
- postgres
|
||||
{% endif %}
|
||||
ports:
|
||||
- "{{ host_port }}:8052"
|
||||
hostname: awxweb
|
||||
user: root
|
||||
restart: unless-stopped
|
||||
{% if awx_container_search_domains is defined %}
|
||||
dns_search: "{{ awx_container_search_domains }}"
|
||||
{% endif %}
|
||||
{% if awx_container_search_domains is defined %}
|
||||
dns: "{{ awx_alternate_dns_servers }}"
|
||||
{% endif %}
|
||||
environment:
|
||||
http_proxy: {{ http_proxy | default('') }}
|
||||
https_proxy: {{ https_proxy | default('') }}
|
||||
no_proxy: {{ no_proxy | default('') }}
|
||||
SECRET_KEY: {{ awx_secret_key }}
|
||||
DATABASE_NAME: {{ pg_database }}
|
||||
DATABASE_USER: {{ pg_username }}
|
||||
DATABASE_PASSWORD: {{ pg_password }}
|
||||
DATABASE_PORT: {{ pg_port }}
|
||||
DATABASE_HOST: {{ pg_hostname|default("postgres") }}
|
||||
RABBITMQ_USER: guest
|
||||
RABBITMQ_PASSWORD: guest
|
||||
RABBITMQ_HOST: rabbitmq
|
||||
RABBITMQ_PORT: 5672
|
||||
RABBITMQ_VHOST: awx
|
||||
MEMCACHED_HOST: memcached
|
||||
MEMCACHED_PORT: 11211
|
||||
AWX_ADMIN_USER: {{ default_admin_user|default('admin') }}
|
||||
AWX_ADMIN_PASSWORD: {{ default_admin_password|default('password') }}
|
||||
|
||||
task:
|
||||
image: {{ awx_task_docker_actual_image }}
|
||||
depends_on:
|
||||
- rabbitmq
|
||||
- memcached
|
||||
- web
|
||||
{% if pg_hostname is not defined %}
|
||||
- postgres
|
||||
{% endif %}
|
||||
hostname: awx
|
||||
user: root
|
||||
restart: unless-stopped
|
||||
{% if awx_container_search_domains is defined %}
|
||||
dns_search: "{{ awx_container_search_domains }}"
|
||||
{% endif %}
|
||||
{% if awx_container_search_domains is defined %}
|
||||
dns: "{{ awx_alternate_dns_servers }}"
|
||||
{% endif %}
|
||||
environment:
|
||||
http_proxy: {{ http_proxy | default('') }}
|
||||
https_proxy: {{ https_proxy | default('') }}
|
||||
no_proxy: {{ no_proxy | default('') }}
|
||||
SECRET_KEY: {{ awx_secret_key }}
|
||||
DATABASE_NAME: {{ pg_database }}
|
||||
DATABASE_USER: {{ pg_username }}
|
||||
DATABASE_PASSWORD: {{ pg_password }}
|
||||
DATABASE_HOST: {{ pg_hostname|default("postgres") }}
|
||||
DATABASE_PORT: {{ pg_port }}
|
||||
RABBITMQ_USER: guest
|
||||
RABBITMQ_PASSWORD: guest
|
||||
RABBITMQ_HOST: rabbitmq
|
||||
RABBITMQ_PORT: 5672
|
||||
RABBITMQ_VHOST: awx
|
||||
MEMCACHED_HOST: memcached
|
||||
MEMCACHED_PORT: 11211
|
||||
AWX_ADMIN_USER: {{ default_admin_user|default('admin') }}
|
||||
AWX_ADMIN_PASSWORD: {{ default_admin_password|default('password') }}
|
||||
|
||||
rabbitmq:
|
||||
image: rabbitmq:3
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
RABBITMQ_DEFAULT_VHOST: awx
|
||||
|
||||
memcached:
|
||||
image: memcached:alpine
|
||||
restart: unless-stopped
|
||||
|
||||
{% if pg_hostname is not defined %}
|
||||
postgres:
|
||||
image: postgres:9.6
|
||||
restart: unless-stopped
|
||||
volumes:
|
||||
- {{ postgres_data_dir }}:/var/lib/postgresql/data:Z
|
||||
environment:
|
||||
POSTGRES_USER: {{ pg_username }}
|
||||
POSTGRES_PASSWORD: {{ pg_password }}
|
||||
POSTGRES_DB: {{ pg_database }}
|
||||
PGDATA: /var/lib/postgresql/data/pgdata
|
||||
{% endif %}
|
||||
Loading…
x
Reference in New Issue
Block a user