53 lines
1.1 KiB
YAML
53 lines
1.1 KiB
YAML
---
|
|
kind: pipeline
|
|
type: docker
|
|
name: ansible
|
|
|
|
steps:
|
|
- name: yaml lint
|
|
image: cytopia/yamllint:alpine
|
|
commands:
|
|
- yamllint -c .yamllint.yml .
|
|
|
|
- name: ansible lint
|
|
image: cytopia/ansible-lint:alpine
|
|
commands:
|
|
- ansible-lint .
|
|
|
|
- name: setup ssh key
|
|
image: alpine:latest
|
|
commands:
|
|
- mkdir -p $HOME/.ssh
|
|
- echo "$SSH_KEY" > $HOME/.ssh/id_ed25519
|
|
- chmod 600 $HOME/.ssh/id_ed25519
|
|
- ssh-keyscan -p 4422 vps.noahknegt.com > $HOME/.ssh/known_hosts
|
|
- ssh -p 4422 vps.noahknegt.com "echo 'SSH connection established'"
|
|
environment:
|
|
SSH_KEY:
|
|
from_secret: ssh_key
|
|
volumes:
|
|
- name: ssh_key
|
|
path: $HOME/.ssh
|
|
when:
|
|
event:
|
|
- push
|
|
branch:
|
|
- master
|
|
|
|
- name: ansible apply
|
|
image: cytopia/ansible:latest-tools
|
|
commands:
|
|
- ansible-playbook -i inventory/hosts.yml site.yml
|
|
volumes:
|
|
- name: ssh_key
|
|
path: $HOME/.ssh
|
|
when:
|
|
event:
|
|
- push
|
|
branch:
|
|
- master
|
|
|
|
volumes:
|
|
- name: ssh_key
|
|
temp: {}
|