Files
gitlab-ci/automation/.gitlab-ci-ansible.yaml
2023-05-27 15:20:40 +09:30

45 lines
1.4 KiB
YAML

---
# This yaml is intended to run ansible jobs using nfc's ansible-ee image
include:
- local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml
.ansible_playbook:
image: nofusscomputing/ansible-ee:dev
stage: chores
variables:
ansible_inventory: ''
ansible_playbook: ''
ansible_tags: ''
script:
- if [ "0$ansible_inventory" != '0' ]; then ansible_inventory=-i $ansible_inventory; fi
- if [ "0$ansible_tags" != '0' ]; then ansible_tags=$(echo -n "--tags $ansible_tags"); fi
- echo "[DEBUG] ansible_inventory=$ansible_inventory"
- echo "[DEBUG] ansible_playbook=$ansible_playbook"
- echo "[DEBUG] ansible_tags=$ansible_tags"
- ansible-playbook $ansible_inventory $ANSIBLE_PLAYBOOK_DIR/$ansible_playbook $ansible_tags -vvv
rules:
- if: '$NFC_AUTO_JOBS == "false"'
when: never
- if: '$CI_PIPELINE_SOURCE == "schedule" && $PIPELINE_RUN_SCHEDULE == "true"'
exists:
- ".nfc_automation.yaml"
when: always
- if: '$CI_PIPELINE_SOURCE == "pipeline" && $PIPELINE_RUN_TRIGGER == "true"'
exists:
- ".nfc_automation.yaml"
when: always
- if: "$CI_COMMIT_BRANCH == 'development'" # on push to dev run to chek for update
exists:
- ".nfc_automation.yaml"
when: always
# this if for testing only
# - if: '$CI_PIPELINE_SOURCE == "push"'
# when: always
# exists:
# - ".nfc_automation.yaml"
- when: never