diff --git a/.drone.yml b/.drone.yml index 7f232d1..ccee337 100644 --- a/.drone.yml +++ b/.drone.yml @@ -14,15 +14,27 @@ steps: commands: - ansible-lint . - - name: ansible apply - image: plugins/ansible:3 - settings: - inventory: inventory/hosts.yml - playbook: site.yml - private_key: - from_secret: ansible_private_key + - 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 when: - branch: - - master event: - push + branch: + - master + + - name: ansible apply + image: cytopia/ansible:infra + commands: + - ansible-playbook -i inventory/hosts site.yml --private-key /drone/src/.ssh/id_ed25519 + when: + event: + - push + branch: + - master diff --git a/inventory/group_vars/all.yml b/inventory/group_vars/all.yml index 146ddd8..a2d0440 100644 --- a/inventory/group_vars/all.yml +++ b/inventory/group_vars/all.yml @@ -1 +1,2 @@ +--- ansible_user: ansible