Setup dedicated repository for your ansible projects, which includes playbooks, roles, and inventories. You might want to have a structure like this:
.
├── .github/workflows
├── collections
│ └── requirements.txt
├── group_vars
│ ├── all
│ ├── dev
│ ├── stage
│ └── prod
├── seed
│ └── *.yml
├── inventory.yml
└── controller_config.yml
This allows you to separate controller configurations for different environment life-cycles.
This is just the specs for my lab and really the minimum requirements to highlight Ansible Controller as Code.
-
1x Automation Controller on OCP4
-
1x OpenShift4 Cluster
-
1x RHEL8 Bastion Server w/ Anisble CLI tools
-
AWS Open Environment for provisioning of resources needed for the demo
This repo currently offers a playbook that will configure Ansible controllers based on variables defined in group_vars and/or seed directory.
-
Seed the required objects to support Controller as Code
-
Located in the seed/directory are the configs to configure credential, project, and template to keep Controller as Code in sync
-
-
Continuous configuration as code
-
Keeps Ansible controllers in sync with code via template webhook
-
-
Ensure inventory.yml has YOUR Ansible Controller host(s) defined
-
Create a GitHub repository secret that is passed during workflow
-
name expected is CONTROLLER_PASSWORD
-
secret should be the password used to login to the controller GUI
-
-
Create a GitHub Personal Access Token (PAT)
-
Create a GitHub repository secret named CAC_PAT with the PAT as the secret
-
Click Seed_CaC_Workflow button below and run workflow
Note
|
You can now check the Actions to watch/check the status of the deployment. |