2023-03-30 14:01:59 +02:00
|
|
|
---
|
|
|
|
|
kind: pipeline
|
|
|
|
|
type: docker
|
|
|
|
|
name: ansible
|
|
|
|
|
|
|
|
|
|
steps:
|
2023-03-30 14:13:35 +02:00
|
|
|
- name: yaml lint
|
|
|
|
|
image: cytopia/yamllint:alpine
|
|
|
|
|
commands:
|
2023-03-30 14:28:10 +02:00
|
|
|
- yamllint -c .yamllint.yml .
|
2023-03-30 14:13:35 +02:00
|
|
|
|
|
|
|
|
- name: ansible lint
|
|
|
|
|
image: cytopia/ansible-lint:alpine
|
|
|
|
|
commands:
|
2023-03-30 14:32:08 +02:00
|
|
|
- ansible-lint .
|
2023-03-30 14:13:35 +02:00
|
|
|
|
2023-03-31 09:40:58 +02:00
|
|
|
- name: setup ssh key
|
|
|
|
|
image: alpine:latest
|
|
|
|
|
commands:
|
2023-03-31 10:22:57 +02:00
|
|
|
- mkdir -p /root/.ssh
|
|
|
|
|
- echo "$SSH_KEY" > /root/.ssh/id_ed25519
|
|
|
|
|
- chmod 600 /root/.ssh/id_ed25519
|
|
|
|
|
- ssh-keyscan -p 4422 vps.noahknegt.com > /root/.ssh/known_hosts
|
2023-03-31 10:12:29 +02:00
|
|
|
- ssh -p 4422 vps.noahknegt.com "echo 'SSH connection established'"
|
2023-03-31 09:40:58 +02:00
|
|
|
environment:
|
|
|
|
|
SSH_KEY:
|
|
|
|
|
from_secret: ssh_key
|
2023-03-31 10:12:29 +02:00
|
|
|
volumes:
|
|
|
|
|
- name: ssh_key
|
2023-03-31 10:22:57 +02:00
|
|
|
path: /root/.ssh
|
2023-03-31 09:40:58 +02:00
|
|
|
|
2023-03-30 14:13:35 +02:00
|
|
|
- name: ansible apply
|
2023-03-31 10:00:13 +02:00
|
|
|
image: cytopia/ansible:latest-tools
|
2023-03-30 15:47:41 +02:00
|
|
|
commands:
|
2023-03-31 10:12:29 +02:00
|
|
|
- ansible-playbook -i inventory/hosts.yml site.yml
|
|
|
|
|
volumes:
|
|
|
|
|
- name: ssh_key
|
2023-03-31 10:22:57 +02:00
|
|
|
path: /root/.ssh
|
2023-03-31 09:55:17 +02:00
|
|
|
when:
|
|
|
|
|
event:
|
|
|
|
|
- push
|
|
|
|
|
branch:
|
|
|
|
|
- master
|
2023-03-31 10:12:29 +02:00
|
|
|
|
|
|
|
|
volumes:
|
|
|
|
|
- name: ssh_key
|
|
|
|
|
temp: {}
|