infrastructure/.drone.yml

63 lines
1.7 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
2023-09-13 05:42:56 +02:00
environment:
ANSIBLE_FORCE_COLOR: true
ANSIBLE_HOME: /drone/src/.ansible
ANSIBLE_VAULT_PASSWORD_FILE: "/drone/src/vault_pass"
2022-09-30 12:35:01 +02:00
node:
2023-08-22 18:27:27 +02:00
ansible: "true"
2022-09-30 12:35:01 +02:00
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
- name: Prepare Runner
2022-09-30 02:47:12 +02:00
image: registry.tobiasmanske.de/ansible-runner:latest
pull: always
commands:
- cd coreos-config
2023-09-13 05:42:56 +02:00
- mkdir $ANSIBLE_HOME
2023-04-06 01:04:16 +02:00
- ansible-galaxy install -r requirements.yaml
- ansible-playbook --private-key ../ssh_key --inventory=inventory.yaml runner-pre.yaml
- name: Run Ansible
image: registry.tobiasmanske.de/ansible-runner:latest
pull: always
commands:
- cd coreos-config
2023-09-13 05:44:20 +02:00
- ansible-playbook --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-04-06 01:04:16 +02:00
- ansible-galaxy install -r requirements.yaml
2023-09-13 05:44:20 +02:00
- ansible-playbook --check --private-key ../ssh_key --inventory=inventory.yaml playbook.yaml
2022-09-30 02:47:12 +02:00
image_pull_secrets:
- registry