Awx tower(ansible) with docker-compose
version: '3'
services:
postgres:
image: "postgres:10.5"
volumes:
- "./data/pgdata:/var/lib/postgresql/data"
restart: always
ports:
- "35432:5432"
environment:
POSTGRES_USER: awx
POSTGRES_PASSWORD: awxpass
POSTGRES_DB: awx
rabbitmq:
image: "rabbitmq:3"
restart: always
environment:
RABBITMQ_DEFAULT_VHOST: awx
memcached:
image: "memcached:alpine"
restart: always
awx_web:
image: "ansible/awx_web:latest"
links:
- rabbitmq
- memcached
- postgres
ports:
- "85:8052"
hostname: awxweb
restart: always
user: root
environment:
SECRET_KEY: aabbcc
DATABASE_USER: awx
DATABASE_PASSWORD: awxpass
DATABASE_NAME: awx
DATABASE_PORT: 5432
DATABASE_HOST: postgres
RABBITMQ_USER: guest
RABBITMQ_PASSWORD: guest
RABBITMQ_HOST: rabbitmq
RABBITMQ_PORT: 5672
RABBITMQ_VHOST: awx
MEMCACHED_HOST: memcached
MEMCACHED_PORT: 11211
AWX_REBUILD_SMART_MEMBERSHIP: 'true'
awx_task:
image: "ansible/awx_task:latest"
links:
- rabbitmq
- memcached
- awx_web:awxweb
- postgres
hostname: awx
user: root
restart: always
environment:
SECRET_KEY: aabbcc
DATABASE_USER: awx
DATABASE_PASSWORD: awxpass
DATABASE_NAME: awx
DATABASE_PORT: 5432
DATABASE_HOST: postgres
RABBITMQ_USER: guest
RABBITMQ_PASSWORD: guest
RABBITMQ_HOST: rabbitmq
RABBITMQ_PORT: 5672
RABBITMQ_VHOST: awx
MEMCACHED_HOST: memcached
MEMCACHED_PORT: 11211
AWX_REBUILD_SMART_MEMBERSHIP: 'true'
Pull images
docker-compose pull
Run
docker-compose up -d
Make nginx proxy config with https for awx ansible
upstream awx {
server 192.168.0.132:85;
}
# let rc deal with the redirection
server {
listen 80;
server_name awx.itc-life.ru;
server_tokens off;
root /dev/null;
access_log /dev/null;
location / {
return 301 https://$server_name$request_uri;
}
}
server {
listen 443 ssl http2;
server_name awx.itc-life.ru;
server_tokens off;
root /dev/null;
include ssl.d/itc-life.ru/ssl.itc-life.ru.conf;
#access_log /dev/null;
location / {
proxy_pass http://awx;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forward-Proto http;
proxy_set_header X-Nginx-Proxy true;
proxy_redirect off;
}
}
Go to interfaces
https://awx.itc-life.ru
Ansible awx update — fix error in postgres /var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/models/sql/compiler.py”, line 899, in execute_sql
Go in docker postgres
docker exec -ti -u 0 awx_postgres_1 sh -c "stty rows 250 && stty cols 250 && bash"
Run psql
psql \c awx
ALTER TABLE main_organization ADD COLUMN job_template_admin_role_id integer; ALTER TABLE main_organization ADD FOREIGN KEY (job_template_admin_role_id) REFERENCES main_rbac_roles(id) DEFERRABLE INITIALLY DEFERRED; UPDATE main_organization SET job_template_admin_role_id = 9;

