From 0c23539f18eccb6c0d6e2a76455278a24b2efc13 Mon Sep 17 00:00:00 2001 From: Noah Knegt Date: Fri, 31 Mar 2023 09:40:58 +0200 Subject: [PATCH] Generate the ssh key from secret in CI Signed-off-by: Noah Knegt --- .drone.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index b97e996..4c547bc 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,15 +14,18 @@ steps: commands: - 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 image: cytopia/ansible:alpine - volumes: - - name: ssh-keys - path: /root/.ssh/ 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/