Drone CI: Add secret management
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Tobias Manske 2023-03-30 19:18:27 +02:00
parent b0375b6630
commit 0059cc494f
Signed by: tobias
GPG Key ID: 9164B527694A0709

View File

@ -15,18 +15,37 @@ node:
ansible: true ansible: true
steps: steps:
- name: Prepare Secrets
image: registry.tobiasmanske.de/ansible-runner:latest
pull: always
environment:
VAULT_PASS:
from_secret: vault_pass
SSH_KEY:
from_secret: ssh_key
commands:
- echo $${VAULT_PASS} > /drone/src/vault_pass
- echo $${SSH_KEY} | base64 -d > /drone/src/ssh_key
- chmod 600 /drone/src/ssh_key
- chmod 600 /drone/src/vault_pass
- name: Run Ansible - name: Run Ansible
image: registry.tobiasmanske.de/ansible-runner:latest image: registry.tobiasmanske.de/ansible-runner:latest
pull: always pull: always
environment:
ANSIBLE_VAULT_PASSWORD_FILE: "/drone/src/vault_pass"
ANSIBLE_FORCE_COLOR: "true"
commands: commands:
- cd coreos-config - cd coreos-config
- ansible-playbook --limit host.nc.chaoswg.org --private-key /ssh_key --inventory=inventory.yaml playbook.yaml - ansible-playbook --limit host.nc.chaoswg.org --private-key ../ssh_key --inventory=inventory.yaml playbook.yaml
- name: Validate Ansible - name: Validate Ansible
image: registry.tobiasmanske.de/ansible-runner:latest image: registry.tobiasmanske.de/ansible-runner:latest
pull: always pull: always
environment:
ANSIBLE_VAULT_PASSWORD_FILE: "/drone/src/vault_pass"
ANSIBLE_FORCE_COLOR: "true"
commands: commands:
- cd coreos-config - cd coreos-config
- ansible-playbook --limit host.nc.chaoswg.org --check --private-key /ssh_key --inventory=inventory.yaml playbook.yaml - ansible-playbook --limit host.nc.chaoswg.org --check --private-key ../ssh_key --inventory=inventory.yaml playbook.yaml
image_pull_secrets: image_pull_secrets:
- registry - registry