Generate the ssh key from secret in CI
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: Noah Knegt <git@noahknegt.com>
This commit is contained in:
19
.drone.yml
19
.drone.yml
@@ -14,15 +14,18 @@ steps:
|
|||||||
commands:
|
commands:
|
||||||
- ansible-lint .
|
- ansible-lint .
|
||||||
|
|
||||||
|
- name: setup ssh key
|
||||||
|
image: alpine:latest
|
||||||
|
commands:
|
||||||
|
- mkdir -p /drone/src/.ssh
|
||||||
|
- echo "$SSH_KEY" > /drone/src/.ssh/id_ed25519
|
||||||
|
- chmod 600 /drone/src/.ssh/id_ed25519
|
||||||
|
environment:
|
||||||
|
SSH_KEY:
|
||||||
|
from_secret: ssh_key
|
||||||
|
|
||||||
- name: ansible apply
|
- name: ansible apply
|
||||||
image: cytopia/ansible:alpine
|
image: cytopia/ansible:alpine
|
||||||
volumes:
|
|
||||||
- name: ssh-keys
|
|
||||||
path: /root/.ssh/
|
|
||||||
commands:
|
commands:
|
||||||
- ansible-playbook -i inventory/hosts site.yml --private-key /root/.ssh/id_ed25519
|
- ansible-playbook -i inventory/hosts site.yml --private-key /drone/src/.ssh/id_ed25519
|
||||||
|
|
||||||
volumes:
|
|
||||||
- name: ssh-keys
|
|
||||||
host:
|
|
||||||
path: /home/ansible/.ssh/
|
|
||||||
|
Reference in New Issue
Block a user