Task 5: Build ACI Pipeline Part 1
Task 5: Build ACI Pipeline Part 1
Git pull from GitHub
Clone the ACI Ansible test repository from GitHub:
cd
git clone https://github.com/beye91/aci-ansible-test.git
rm -rf aci-ansible-test/.gitExpected output:
Cloning into 'aci-ansible-test'...
remote: Enumerating objects: 22, done.
remote: Counting objects: 100% (22/22), done.
remote: Compressing objects: 100% (17/17), done.
remote: Total 22 (delta 0), reused 22 (delta 0), pack-reused 0
Unpacking objects: 100% (22/22), 6.91 KiB | 1.15 MiB/s, done.
Git pull from GitLab
Navigate to your GitLab project's Repository > Files > Clone and copy the URL.
Execute the clone command:
cd
git clone "YOUR-URL"Expected output shows successful cloning with authentication:
Cloning into 'aci-ansible-cicd'...
Username for 'http://198.18.134.28': root
Password for 'http://root@198.18.134.28': [enter password]
remote: Enumerating objects: 12, done...
Verify files:
cd aci-ansible-cicd
ls -laMerge Repository Contents
Copy all files from the GitHub repository into your GitLab clone:
cp -r ../aci-ansible-test/* .
ls -laExpected files include: ansibledata.yml, create_snapshot.yml, .gitlab-ci.yml, hosts, playbook.yml, requirements.yml, roles/ directory, and usage_info.txt.
Git push to GitLab
Commit and push changes:
git add * && git commit -m 'Commit' && git pushProvide your GitLab credentials when prompted.
Configure the Pipeline
Open CI/CD > Editor in your GitLab project. Replace the entire pipeline configuration with:
workflow:
rules:
- if: $CI_COMMIT_BRANCH != "main" && $CI_PIPELINE_SOURCE != "merge_request_event"
when: never
- when: always
stages:
- deploy_aci_config
run_ansible_playbook:
stage: deploy_aci_config
tags:
- shell
before_script:
- ansible-galaxy collection install cisco.aci
script:
- ansible-playbook -i hosts playbook.ymlCommit these changes. Your pipeline will automatically trigger on each commit.
Verify Deployment
Monitor the pipeline execution in GitLab. Click on the run_ansible_playbook job to review execution details. Upon successful completion, log into your APIC GUI to confirm the tenant configuration has been deployed correctly.
