default: image: registry.gitlab/next-gen-portal/infra-custom-images/ansible-utilities:latest tags: - docker stages: - validate - deploy - security include: - project: 'next-gen-portal/ci-templates' ref: 'main' file: '/templates/openbao/with-secret.yml' ansible-lint: stage: validate script: - export ANSIBLE_CONFIG=$CI_PROJECT_DIR/ansible.cfg - ansible-galaxy collection install -r requirements.yml - ansible-lint syntax-check: stage: validate script: - export ANSIBLE_CONFIG=$CI_PROJECT_DIR/ansible.cfg - ansible-galaxy collection install -r requirements.yml - ansible-inventory --list > /dev/null - | set -eu for playbook in playbooks/*.yml; do echo "Syntax checking ${playbook}" ansible-playbook --syntax-check "$playbook" done # deploy-prod: # extends: .openbao-with-secrets # stage: deploy # id_tokens: # OPENBAO_ID_TOKEN: # aud: "https://openbao.helmholz.local:8200" # variables: # OPENBAO_SECRET_REQUESTS_FILE: "secrets.json" # script: # - | # set -eu # echo "Setting up SSH..." # mkdir -p ~/.ssh # printf '%s\n' "$VPN_ADMIN_PRIVATE_KEY" > ~/.ssh/id_ed25519 # chmod 600 ~/.ssh/id_ed25519 # export ANSIBLE_CONFIG="$CI_PROJECT_DIR/ansible.cfg" # ansible-galaxy collection install -r requirements.yml # ansible-playbook playbooks/nat-gateway.yml --limit nat_gateways # ansible-playbook playbooks/private-vpn-routing.yml --limit vpn_nodes # ansible-playbook playbooks/openvpn.yml # when: manual # sbom: # extends: .openbao-with-secrets # stage: security # id_tokens: # OPENBAO_ID_TOKEN: # aud: "https://openbao.helmholz.local:8200" # variables: # OPENBAO_SECRET_REQUESTS_FILE: "secrets.json" # needs: # - deploy-prod # script: # - | # set -eu # echo "Setting up SSH..." # mkdir -p ~/.ssh # printf '%s\n' "$VPN_ADMIN_PRIVATE_KEY" > ~/.ssh/id_ed25519 # chmod 600 ~/.ssh/id_ed25519 # export ANSIBLE_CONFIG="$CI_PROJECT_DIR/ansible.cfg" # ansible-playbook playbooks/sbom.yml # artifacts: # when: always # paths: # - reports/sbom/ # expire_in: 365 days # trivy:sbom: # stage: security # needs: # - job: sbom # artifacts: true # script: # - ls -R reports || true # - mkdir -p reports/trivy # - | # if compgen -G "reports/sbom/*.json" > /dev/null; then # for sbom in reports/sbom/*.json; do # filename=$(basename "$sbom" .json) # echo "Scanning $sbom" # trivy sbom \ # --format json \ # --output "reports/trivy/${filename}-trivy.json" \ # --exit-code 0 \ # "$sbom" # trivy sbom \ # --format table \ # --output "reports/trivy/${filename}-trivy.txt" \ # --exit-code 0 \ # "$sbom" # done # else # echo "No SBOM files found." # exit 1 # fi # artifacts: # when: always # expire_in: 365 days # paths: # - reports/trivy/