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:
|
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
|
2023-09-13 05:05:18 +02:00
|
|
|
- name: Prepare Runner
|
2022-09-30 02:47:12 +02:00
|
|
|
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-04-06 01:04:16 +02:00
|
|
|
- ansible-galaxy install -r requirements.yaml
|
2023-09-13 05:05:18 +02:00
|
|
|
- ansible-playbook --private-key ../ssh_key --inventory=inventory.yaml runner-pre.yaml
|
|
|
|
- name: Run Ansible
|
|
|
|
image: registry.tobiasmanske.de/ansible-runner:latest
|
|
|
|
pull: always
|
|
|
|
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 --private-key ../ssh_key --inventory=inventory.yaml playbook.yaml
|
2022-09-30 22:27:04 +02:00
|
|
|
- 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"
|
2022-09-30 22:27:04 +02:00
|
|
|
commands:
|
|
|
|
- cd coreos-config
|
2023-04-06 01:04:16 +02:00
|
|
|
- ansible-galaxy install -r requirements.yaml
|
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
|