Skip to content

r3dact3d/Ansible-Controller-as-Code

Repository files navigation

AnsibleProject

Organize Your Repository

Setup dedicated repository for your ansible projects, which includes playbooks, roles, and inventories. You might want to have a structure like this:

Directory Structure
.
├── .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.

Ansible Automation Platform

This is just the specs for my lab and really the minimum requirements to highlight Ansible Controller as Code.

Specifications
  • 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

Workflow

This repo currently offers a playbook that will configure Ansible controllers based on variables defined in group_vars and/or seed directory.

There are two parts:

  1. Seed the required objects to support Controller as Code

    1. Located in the seed/directory are the configs to configure credential, project, and template to keep Controller as Code in sync

  2. Continuous configuration as code

    1. Keeps Ansible controllers in sync with code via template webhook

Before Seeding Controller as Code:

  1. Ensure inventory.yml has YOUR Ansible Controller host(s) defined

  2. Create a GitHub repository secret that is passed during workflow

    1. name expected is CONTROLLER_PASSWORD

    2. secret should be the password used to login to the controller GUI

  3. Create a GitHub Personal Access Token (PAT)

  4. Create a GitHub repository secret named CAC_PAT with the PAT as the secret

  5. Click Seed_CaC_Workflow button below and run workflow

badge
Note
You can now check the Actions to watch/check the status of the deployment.

Completing the sync webhook

  1. Manual task currently to get webhook url and token from the Job Template in the controller UI

Function

This will create admin credential, and a project with template to get stats from the controller. To highlight the syncing ability from Git to Controller.

    link:https://github.com/redhat-cop/controller_configuration.git
#v1-2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages