Created
June 29, 2020 15:25
-
-
Save bryanasdev000/1d6c16b68a28f44799b00bb3c96953cd to your computer and use it in GitHub Desktop.
AWX Cluster with docker-compose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
web: | |
image: ansible/awx:13.0.0 | |
container_name: awx_web | |
depends_on: | |
- redis | |
ports: | |
- "80:8052" | |
hostname: awxweb | |
user: root | |
restart: unless-stopped | |
volumes: | |
- supervisor-socket:/var/run/supervisor | |
- rsyslog-socket:/var/run/awx-rsyslog/ | |
- rsyslog-config:/var/lib/awx/rsyslog/ | |
- "~/.awx/awxcompose/SECRET_KEY:/etc/tower/SECRET_KEY" | |
- "~/.awx/awxcompose/environment.sh:/etc/tower/conf.d/environment.sh" | |
- "~/.awx/awxcompose/credentials.py:/etc/tower/conf.d/credentials.py" | |
- "~/.awx/awxcompose/nginx.conf:/etc/nginx/nginx.conf:ro" | |
- "~/.awx/awxcompose/settings.py:/etc/tower/settings.py" # Add settings config | |
- "~/.awx/awxcompose/redis_socket:/var/run/redis/:rw" | |
environment: | |
http_proxy: | |
https_proxy: | |
no_proxy: | |
# Make sure that you can ping othes node with extra_hosts or awx_container_search_domains | |
task: | |
image: ansible/awx:13.0.0 | |
container_name: awx_task | |
depends_on: | |
- redis | |
- web | |
command: /usr/bin/launch_awx_task.sh | |
hostname: AWX01 | |
user: root | |
restart: unless-stopped | |
volumes: | |
- supervisor-socket:/var/run/supervisor | |
- rsyslog-socket:/var/run/awx-rsyslog/ | |
- rsyslog-config:/var/lib/awx/rsyslog/ | |
- "~/.awx/awxcompose/SECRET_KEY:/etc/tower/SECRET_KEY" | |
- "~/.awx/awxcompose/environment.sh:/etc/tower/conf.d/environment.sh" | |
- "~/.awx/awxcompose/credentials.py:/etc/tower/conf.d/credentials.py" | |
- "~/.awx/awxcompose/settings.py:/etc/tower/settings.py" # Add settings config | |
- "~/.awx/awxcompose/redis_socket:/var/run/redis/:rw" | |
environment: | |
http_proxy: | |
https_proxy: | |
no_proxy: | |
SUPERVISOR_WEB_CONFIG_PATH: '/etc/supervisord.conf' | |
# Make sure that you can ping othes node with extra_hosts or awx_container_search_domains | |
redis: | |
image: redis | |
container_name: awx_redis | |
restart: unless-stopped | |
environment: | |
http_proxy: | |
https_proxy: | |
no_proxy: | |
command: ["/usr/local/etc/redis/redis.conf"] | |
volumes: | |
- "~/.awx/awxcompose/redis.conf:/usr/local/etc/redis/redis.conf:ro" | |
- "~/.awx/awxcompose/redis_socket:/var/run/redis/:rw" | |
volumes: | |
supervisor-socket: | |
rsyslog-socket: | |
rsyslog-config: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# AWX settings file | |
import os | |
def get_secret(): | |
if os.path.exists("/etc/tower/SECRET_KEY"): | |
return open('/etc/tower/SECRET_KEY', 'rb').read().strip() | |
ADMINS = () | |
STATIC_ROOT = '/var/lib/awx/public/static' | |
PROJECTS_ROOT = '/var/lib/awx/projects' | |
AWX_ANSIBLE_COLLECTIONS_PATHS = '/var/lib/awx/vendor/awx_ansible_collections' | |
JOBOUTPUT_ROOT = '/var/lib/awx/job_status' | |
SECRET_KEY = get_secret() | |
ALLOWED_HOSTS = ['*'] | |
# Container environments don't like chroots | |
AWX_PROOT_ENABLED = False | |
CLUSTER_HOST_ID = "AWX01" # Change to hostname of the container & machine | |
SYSTEM_UUID = '00000000-0000-0000-0000-000000000000' | |
CSRF_COOKIE_SECURE = False | |
SESSION_COOKIE_SECURE = False | |
############################################################################### | |
# EMAIL SETTINGS | |
############################################################################### | |
SERVER_EMAIL = 'root@localhost' | |
DEFAULT_FROM_EMAIL = 'webmaster@localhost' | |
EMAIL_SUBJECT_PREFIX = '[AWX] ' | |
EMAIL_HOST = 'localhost' | |
EMAIL_PORT = 25 | |
EMAIL_HOST_USER = '' | |
EMAIL_HOST_PASSWORD = '' | |
EMAIL_USE_TLS = False | |
LOGGING['handlers']['console'] = { | |
'()': 'logging.StreamHandler', | |
'level': 'DEBUG', | |
'formatter': 'simple', | |
} | |
LOGGING['loggers']['django.request']['handlers'] = ['console'] | |
LOGGING['loggers']['rest_framework.request']['handlers'] = ['console'] | |
LOGGING['loggers']['awx']['handlers'] = ['console', 'external_logger'] | |
LOGGING['loggers']['awx.main.commands.run_callback_receiver']['handlers'] = ['console'] | |
LOGGING['loggers']['awx.main.tasks']['handlers'] = ['console', 'external_logger'] | |
LOGGING['loggers']['awx.main.scheduler']['handlers'] = ['console', 'external_logger'] | |
LOGGING['loggers']['django_auth_ldap']['handlers'] = ['console'] | |
LOGGING['loggers']['social']['handlers'] = ['console'] | |
LOGGING['loggers']['system_tracking_migrations']['handlers'] = ['console'] | |
LOGGING['loggers']['rbac_migrations']['handlers'] = ['console'] | |
LOGGING['loggers']['awx.isolated.manager.playbooks']['handlers'] = ['console'] | |
LOGGING['handlers']['callback_receiver'] = {'class': 'logging.NullHandler'} | |
LOGGING['handlers']['task_system'] = {'class': 'logging.NullHandler'} | |
LOGGING['handlers']['tower_warnings'] = {'class': 'logging.NullHandler'} | |
LOGGING['handlers']['rbac_migrations'] = {'class': 'logging.NullHandler'} | |
LOGGING['handlers']['system_tracking_migrations'] = {'class': 'logging.NullHandler'} | |
LOGGING['handlers']['management_playbooks'] = {'class': 'logging.NullHandler'} | |
DATABASES = { | |
'default': { | |
'ATOMIC_REQUESTS': True, | |
'ENGINE': 'awx.main.db.profiled_pg', | |
'NAME': os.getenv("DATABASE_NAME", None), | |
'USER': os.getenv("DATABASE_USER", None), | |
'PASSWORD': os.getenv("DATABASE_PASSWORD", None), | |
'HOST': os.getenv("DATABASE_HOST", None), | |
'PORT': os.getenv("DATABASE_PORT", None), | |
} | |
} | |
if os.getenv("DATABASE_SSLMODE", False): | |
DATABASES['default']['OPTIONS'] = {'sslmode': os.getenv("DATABASE_SSLMODE")} | |
USE_X_FORWARDED_HOST = True | |
USE_X_FORWARDED_PORT = True | |
BROADCAST_WEBSOCKET_PROTOCOL = 'http' # http | |
BROADCAST_WEBSOCKET_PORT = 80 # http |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a very simple gist to deploy a AWX cluster using the official 'local_docker' role.