Skip to content

Commit

Permalink
Save server public key as gh actions secret
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Aug 28, 2024
1 parent a9eceda commit 1c98f10
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ jobs:
- name: Run playbook
working-directory: ansible
env:
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
ansible_vault_key: ${{ secrets.ANSIBLE_VAULT_KEY }}
server_public_key: ${{ secrets.SERVER_PUBLIC_KEY }}
run: |
source .venv/bin/activate
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
echo "${{ secrets.ANSIBLE_VAULT_KEY }}" > ~/.vault_pass.txt
echo "$ssh_private_key" > ~/.ssh/id_ed25519
echo "$ansible_vault_key" > ~/.vault_pass.txt
echo "$server_public_key" > ~/.ssh/known_hosts
ansible-playbook \
-i inventory.yml playbook.yml \
--vault-password-file ~/.vault_pass.txt \
Expand Down

0 comments on commit 1c98f10

Please sign in to comment.