Task 6: Build ACI Pipeline Part 2
Task 6: Build ACI Pipeline Part 2
Adding Snapshot Stage
Update your pipeline configuration with the following code and commit the changes:
workflow:
rules:
- if: $CI_COMMIT_BRANCH != "main" && $CI_PIPELINE_SOURCE != "merge_request_event"
when: never
- when: always
stages:
- prepare_aci
- deploy_aci_config
run_prepare_playbook:
stage: prepare_aci
tags:
- shell
before_script:
- ansible-galaxy collection install cisco.aci
script:
- ansible-playbook -i hosts create_snapshot.yml
run_deploy_playbook:
stage: deploy_aci_config
tags:
- shell
before_script:
- ansible-galaxy collection install cisco.aci
script:
- ansible-playbook -i hosts playbook.ymlView the pipeline results directly from the pipeline editor in GitLab. After execution, login to your ACI controller and verify that the snapshot has been successfully created.
Changing the ACI Configuration
The ansible.yml file contains all ACI configuration data. Navigate to your repository and locate this file. Click the "Open in Web IDE" button to edit files directly in your browser.
Scroll down to the tenant section (starting at line 59). You can duplicate this data to create a second tenant for testing purposes.
Commit your changes to the main branch. The pipeline will automatically trigger, and your modifications will be deployed to the APIC. This demonstrates the power of infrastructure-as-code—whenever you update the configuration file, the CI/CD pipeline applies those changes automatically to your ACI environment.
