Setup the Automation Controller ( AWX ) using Ansible
- Kubernetes Cluster Setup: Ansible takes the lead in configuring a
Kubernetes instance, leveraging the
microk8srole within the
- Kubernetes Configuration: With the Kubernetes cluster primed, Ansible
proceeds to configure it further, harnessing the
kubernetesrole from the same
- AWX Deployment: The deployment of AWX onto the Kubernetes cluster is orchestrated using the AWX Operator Helm Chart. Ansible seamlessly manages this deployment process.
- AWX Customization: To finalize the setup, the
awxrole is employed to tailor the AWX instance to the desired configuration.
Upon successful completion of these steps, you’ll gain access to the AWX interface by visiting the following URL: https://awx.c2platform.org .
Create the reverse and forward proxy
unset PLAY # ensure all plays run
vagrant up c2d-rproxy1
For more information about the various roles that
c2d-rproxy1 performs in this project:
- Setup Reverse Proxy and CA server
- Setup SOCKS proxy
- Managing Server Certificates as a Certificate Authority
- Setup DNS for Kubernetes
To create the Kubernetes instance and deploy the AWX instance, execute the following command:
vagrant up c2d-awx1
AWX may take some time to become available, which could potentially cause Ansible to fail during step 4, AWX Customization:. If you encounter a failure, please ensure that you can access the AWX web interface. Once you see the login screen, you can re-run the provisioning process with the following command:
vagrant provision c2d-awx1
To verify your AWX instance, follow these steps:
- Access the Kubernetes Dashboard by visiting https://dashboard-awx.c2platform.org/
and log in using a token. Obtain the token by running the
kubectlcommand shown below inside the
- Once logged in, navigate to the awx
namespace. Check if the
awx-taskpods are running without any errors.
kubectl -n kube-system describe secret microk8s-dashboard-token
For more information about obtaining the token and setting up the Kubernetes Dashboard, refer to the Setup the Kubernetes Dashboard guide.
- To access the AWX web interface, go to https://awx.c2platform.org
. Use the
adminaccount with the password
secretto log in.
- Once logged in, navigate to the Templates section.
- From there, you can launch various plays, such as the reverse proxy play
c2-reverse-proxyor one of the AWX plays
To gain a better understanding of how the AWX instance is created using Ansible, you can review the following:
In Ansible playbook project
Vagrantfile.yml: This file configures the
c2d-awx1node with the
mgmt/awxplaybook. This file is read in the
hosts-dev.ini: The inventory file assigns the
c2d-awx1node to the
awx-newAnsible group and
plays/mgmt/awx.yml: This playbook sets up Ansible roles for the
group_vars/awx_new/main.yml: This file contains the main configuration for Kubernetes, including enabling add-ons like
group_vars/awx_new/files.yml: Here, you can find the configuration for creating the AWX Helm Chart in the
group_vars/awx_new/kubernetes.yml: This file includes the configuration to set up the Kubernetes cluster and install AWX on it.
group_vars/awx_new/awx.yml: This file includes the configuration to configure AWX. It will for setup an organization, credentials, an execution environment and a job template to provision the reverse proxy.
AWX Configuration Play
The AWX Configuration Play is responsible for managing AWX using AWX itself.
Its purpose is to be executed within the AWX environment. Unlike the standard
AWX Play, this play employs fewer roles—specifically, it includes
c2platform.mgmt.awx. Its scope is limited
to configuring AWX, and it assumes the AWX instance has already been
established. This play serves as an illustrative example of how AWX can
autonomously manage its own setup.
plays/mgmt/awx_config.yml: This playbook establishes the Ansible roles required for the
group_vars/awx_config/main.yml: This file contains the configuration settings for AWX customization. It is a direct copy of
group_vars/awx_new/awx.yml. Note: In a real-world scenario, copying configuration code like this would not be recommended.
Within the Ansible collection project c2platform.mw:
Inside the Ansible collection project c2platform.mgmt:
Within the AWX instance via https://awx.c2platform.org
, you can
examine all components generated based on the configurations found in
group_vars/awx_config/main.yml. For instance:
- Job Templates like
- Credentials such as
- The Project named
c2dand the Inventory named
If you prefer to perform the AWX installation manually, you can provision the
c2d-awx1 node without the
c2platform.mw.kubernetes Ansible role. To do this,
disable or remove the
c2platform.mw.kubernetes role in
By running the
vagrant up c2d-awx1 command, an “empty” Kubernetes cluster will
be created. After that, you can follow the documentation to set up AWX.
Here are the relevant resources for the manual installation process:
However, there is an issue when using a MicroK8s-based Kubernetes cluster. The
kubectl apply command will fail with the following message:
evalsymlink failure on ‘/home/vagrant/github.com/ansible/awx-operator/config/default?ref=2.2.1’
vagrant@c2d-awx1:~$ kubectl apply -k .
error: accumulating resources: accumulation err='accumulating resources from 'github.com/ansible/awx-operator/config/default?ref=2.2.1': evalsymlink failure on '/home/vagrant/github.com/ansible/awx-operator/config/default?ref=2.2.1' : lstat /home/vagrant/github.com: no such file or directory': git cmd = '/snap/microk8s/5392/usr/bin/git fetch --depth=1 origin 2.2.1': exit status 128
To reproduce this message, create a file
/home/vagrant/kustomization.yaml with the contents shown below and run the command
kubectl apply -k .:
vagrant@c2d-awx1:~$ cat kustomization.yaml
- name: quay.io/ansible/awx-operator
As a result of the failure of Kustomize , the Helm Chart option was used instead.
- ansible/awx-operator: An Ansible AWX operator for Kubernetes built with Operator SDK and Ansible.
- Ansible Documentation
- Trusting a custom certificate authority - Adnsible AWX Operator Documentation
- Red Hat Communities of Practice
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.