Task 6: Build ACI pipeline part 2

Table of Contents

Adding Snapshot stage

Now edit the pipeline config again 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.yml
				
			

View directly the pipeline results from the pipeline editor:

Login to ACI and check if the snapshot has been created:

Changing the ACI Config

You might have wondered where all the ACI config comes from. The file which contains all data is the ansible.yml file.
Go to the repository and click on the file to show the content:

Click on the blue button “Open in Web IDE”. This a very nice feature to work with files inside of the browser.

Now scroll down to the tenant section which starts at line 59. Copy the data as follows to create a second tenant:

Commit the change

Commit to the main branch:

Check the pipeline status and verify the ACI config on the APIC:

Great! Whenever the config will be changed your pipeline will be triggered and the changes will be done on the APIC!