infrastructure/.drone.yml

52 lines
1.3 KiB
YAML
Raw Normal View History

2022-09-30 12:35:01 +02:00
---
2022-09-30 02:47:12 +02:00
kind: pipeline
type: docker
2022-09-30 12:35:01 +02:00
name: Ansible-Playbook
2022-09-30 02:47:12 +02:00
trigger:
branch:
- main
event:
include:
- push
- custom
2022-09-30 12:35:01 +02:00
node:
ansible: true
2022-09-30 02:47:12 +02:00
steps:
2023-03-30 19:18:27 +02:00
- 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
2022-09-30 02:47:12 +02:00
- name: Run Ansible
image: registry.tobiasmanske.de/ansible-runner:latest
pull: always
2023-03-30 19:18:27 +02:00
environment:
ANSIBLE_VAULT_PASSWORD_FILE: "/drone/src/vault_pass"
ANSIBLE_FORCE_COLOR: "true"
2022-09-30 02:47:12 +02:00
commands:
- cd coreos-config
2023-03-30 21:18:30 +02:00
- ansible-playbook --limit ci_apply --private-key ../ssh_key --inventory=inventory.yaml playbook.yaml
- name: Validate Ansible
image: registry.tobiasmanske.de/ansible-runner:latest
pull: always
2023-03-30 19:18:27 +02:00
environment:
ANSIBLE_VAULT_PASSWORD_FILE: "/drone/src/vault_pass"
ANSIBLE_FORCE_COLOR: "true"
commands:
- cd coreos-config
2023-03-30 21:18:30 +02:00
- ansible-playbook --limit ci_apply --check --private-key ../ssh_key --inventory=inventory.yaml playbook.yaml
2022-09-30 02:47:12 +02:00
image_pull_secrets:
- registry