Add staging stage to CI/CD
Edit the gitlab-ci.yml file again and add a stage of staging to the stages section so that it looks like the following:
stages:
- registry
- container
- info
- test
- staging
Next add the following staging definition to the end of the file:
config_stage:
stage: staging
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: manual
image: ${CI_REGISTRY}/${CI_PROJECT_PATH}/ansible:latest
tags:
- ansible_f5
dependencies:
- test_code
variables:
ANSIBLE_HOST_KEY_CHECKING: "False"
allow_failure: false
script:
- echo $ANSIBLE_VAULT_PASSWORD > vault_passwd
- ansible-galaxy collection list
- ansible-playbook -i inventories/staging/ --vault-password-file vault_passwd bigip-node.yml
- ansible-playbook -i inventories/staging/ --vault-password-file vault_passwd bigip-pool.yml
- ansible-playbook -i inventories/staging/ --vault-password-file vault_passwd bigip-pool-members.yml
- ansible-playbook -i inventories/staging/ --vault-password-file vault_passwd bigip-irule.yml
- ansible-playbook -i inventories/staging/ --vault-password-file vault_passwd bigip-virtual-server.yml
- ansible-playbook -i inventories/staging/ --vault-password-file vault_passwd bigip-config.yml
Commit the changes.