Configuration as Code with ansible.platform Collection in AAP 2.6
By Luca Berton · Published 2024-01-01 · Category: installation
How to manage your AAP 2.6 deployment as code using the new ansible.platform collection with unified RBAC and standardized variables.

Introduction
AAP 2.6 introduces improved platform management collections that enable true configuration-as-code for your entire automation platform. The ansible.platform collection centralizes management through the Gateway API with standardized variables.
See also: AI-Assisted Inventory Generation in AAP 2.6 — Developer Preview
Why Configuration as Code for AAP?
Managing your automation platform as code provides: • Reproducibility — Rebuild environments from scratch • Version control — Track all configuration changes in Git • Consistency — Same configuration across dev, staging, production • Automation — No manual clicks in the UI • Audit trail — Complete history of who changed what
The ansible.platform Collection
Installation
ansible-galaxy collection install ansible.platform
Authentication Setup
# group_vars/all.yml
aap_host: gateway.example.com
aap_username: admin
aap_password: "{{ vault_aap_password }}"
aap_verify_ssl: true
See also: How to Use the AAP 2.6 Automation Dashboard to Measure ROI
Managing Resources as Code
Organizations
- name: Configure organizations
ansible.platform.organization:
name: "{{ item.name }}"
description: "{{ item.description }}"
state: present
loop:
- name: "IT Operations"
description: "Infrastructure and operations team"
- name: "Development"
description: "Application development team"
Teams and RBAC
- name: Configure teams
ansible.platform.team:
name: "Network Automation"
organization: "IT Operations"
state: present
- name: Assign roles
ansible.platform.role:
user: "jsmith"
role: "Automation Operator"
organization: "IT Operations"
state: present
Job Templates
- name: Configure job templates
ansible.platform.job_template:
name: "Deploy Web Application"
organization: "Development"
project: "webapp-automation"
playbook: "deploy.yml"
inventory: "production"
credentials:
- "SSH Key"
- "Vault Credentials"
state: present
Workflows
- name: Configure workflow
ansible.platform.workflow_job_template:
name: "Full Deployment Pipeline"
organization: "Development"
state: present
- name: Add workflow nodes
ansible.platform.workflow_job_template_node:
workflow: "Full Deployment Pipeline"
job_template: "Deploy Web Application"
success_nodes:
- "Run Tests"
state: present
GitOps Workflow
Repository Structure
aap-config/
├── inventories/
│ └── aap_hosts.yml
├── group_vars/
│ └── all.yml
├── playbooks/
│ ├── configure-orgs.yml
│ ├── configure-teams.yml
│ ├── configure-templates.yml
│ └── configure-workflows.yml
├── requirements.yml
└── site.yml
CI/CD Integration
# .gitlab-ci.yml
deploy_aap_config:
stage: deploy
script:
- ansible-galaxy collection install -r requirements.yml
- ansible-playbook site.yml -i inventories/aap_hosts.yml
only:
- main
See also: Key Metrics and KPIs to Track in the AAP 2.6 Automation Dashboard
Best Practices
Store secrets in Vault — Never commit passwords to Git Use idempotent playbooks — Run them repeatedly without side effects Environment-specific vars — Use group_vars for dev/staging/prod differences PR reviews — Require reviews for AAP configuration changes Gradual adoption — Start with a few resource types and expandConclusion
Configuration as code for AAP 2.6 brings the same discipline and auditability to your automation platform that you apply to your infrastructure. The unified ansible.platform collection makes this easier than ever.
For more Ansible tutorials and guides, explore the complete article collection on Ansible Pilot.
Related Articles
• publishing collections to Ansible Galaxy • the Ansible template module reference • integrating Ansible Vault with CI • Ansible inventory best practices • Ansible loop patterns and tipsCategory: installation