bsmeding.awx_docker
Ansible AWX Installation Role
This role installs AWX using Docker on Ubuntu. Docker should be installed with my bsmeding.docker
role on Linux systems.
The role installs AWX in Docker containers on the host using the latest stable Docker version (17.1.0). Higher versions are built in Docker but are not officially recommended for production by Ansible.
Running the Role Twice
After a successful deployment, a file named awx_playbook_complete
will be placed in the docker_compose
directory. If the role is run again, it will skip the installation and only configure AWX. If you want to redeploy, remove this file from the host first.
Dependencies
You need to install the awx.awx
collection for configuring AWX post-installation:
ansible-galaxy collection install awx.awx
For RedHat, you must first install the EPEL repository (see geerlingguy.ansible_role_epel
).
Ansible Versions up to 17.1 (Default)
This role installs AWX in Docker containers. For newer versions, Kubernetes is generally the preferred method, and while installing higher versions in Docker is possible, it is only recommended for development.
Ansible 18 and Above
Currently, these versions are not supported! Future releases of this role may allow building higher versions directly on the host, but this will also only be advised for development environments.
Creating a Super User
In newer versions, creating a super user via environment variables isn't possible. You need to run a command inside the container. Log in to the Docker host and execute:
docker exec -ti tools_awx_1 awx-manage createsuperuser
Answer the prompts for username, email, and password.
Creating Virtual Environments (AWX versions up to 17.1)
For AWX versions up to 17.1.0, a Python virtual environment is used. You can install these with this playbook by setting the custom_venv
variable with a list of virtual environments to create. You'll also need the path custom_venv_dir
, which will be created on the host and linked to the AWX container. This variable is required in AWX settings as custom_venv
.
You can optionally specify a different Python version for the virtual environment by setting the python_version
variable. If not specified, it defaults to the OS version of Python.
custom_venv_delete_before_install: false
custom_venv_dir: /opt/awx/venv
custom_python_dir: /opt/python
custom_venvs:
- name: ansible2_10_3
python_version: 3.6.8
ansible_pip_packages:
- ansible==2.10.3
- ansible-lint
- pynautobot
- jmespath
- napalm
- netmiko
- paramiko
The virtual environment path will be automatically added to the AWX instance.
LDAP Configuration
You can add LDAP configuration if necessary. The default and 1 LDAP servers can currently be configured.
# awx__ldap_server_uri: ldap://ldap.example.com:3380
# awx__ldap_bind_dn: CN=readonly,OU=people,DC=example,DC=com
# awx__ldap_bind_password: password
# awx__ldap_group_type: NestedMemberDNGroupType
# awx__ldap_user_dn_template: uid=%(user)s,ou=people,dc=example,dc=com
# awx__ldap_require_group: cn=AWX,ou=groups,dc=example,dc=com
# awx__ldap_deny_group: ''
# awx__ldap_user_search: []
# awx__ldap_group_search: []
# awx__ldap_user_attr_map: {}
# awx__ldap_group_type_parameters: {}
# awx__ldap_user_flags_by_group: {}
# awx__ldap_organization_map: {}
# awx__ldap_team_map: {}
Example configuration for LDAP support and automatic group setup:
awx__ldap_server_uri: ldap://192.168.71.10:3380
awx__ldap_bind_dn: CN=readonly,OU=people,DC=example,DC=com
awx__ldap_bind_password: password
awx__ldap_group_type: NestedMemberDNGroupType
awx__ldap_user_dn_template: uid=%(user)s,ou=people,dc=example,dc=com
awx__ldap_require_group: cn=AWX,ou=groups,dc=example,dc=com
awx__ldap_deny_group: ''
awx__ldap_user_search: [
"cn=people,dc=example,dc=com",
"SCOPE_SUBTREE",
"(uid=%(user)s)"
]
awx__ldap_group_search: [
"ou=groups,dc=example,dc=com",
"SCOPE_SUBTREE",
"(objectClass=posixGroup)"
]
awx__ldap_user_attr_map: {
"first_name": "givenName",
"last_name": "sn"
}
awx__ldap_group_type_parameters: {
"name_attr": "cn",
"member_attr": "member"
}
awx__ldap_user_flags_by_group: {
"is_superuser": [
"cn=ldap_admin,ou=groups,dc=example,dc=com"
]
}
awx__ldap_organization_map: {}
awx__ldap_team_map: {
"Network Management": {
"users": [
"cn=awx,ou=groups,dc=example,dc=com"
],
"organization": "MyOrg",
"remove": true
},
"Network Developers": {
"users": [
"cn=awx_developer,ou=groups,dc=example,dc=com"
],
"organization": "MyOrg",
"remove": true
}
}
Organizations and Teams
To add organizations and/or teams, include the following variables:
awx__organizations:
- name: MyOrg
# custom_virtualenv: ansible3
teams:
- name: DevOps
description: DevOps
- name: Support
description: Support Team
Role to Install Ansible AWX (opensource Tower) in Docker container
ansible-galaxy install bsmeding.awx_docker