Update
This commit is contained in:
@@ -41,18 +41,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Setup SSH key with passphrase
|
- name: Setup SSH key with passphrase
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.ssh
|
echo " Checking SSH key setup..."
|
||||||
printf "%s\n" "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
|
head -5 ~/.ssh/id_rsa | cat -v
|
||||||
chmod 600 ~/.ssh/id_rsa
|
ls -l ~/.ssh/id_rsa
|
||||||
ssh-keyscan -H 213.95.90.157 >> ~/.ssh/known_hosts
|
file ~/.ssh/id_rsa || echo "file command not available"
|
||||||
eval "$(ssh-agent -s)"
|
echo " Testing SSH connection..."
|
||||||
ssh-add ~/.ssh/id_rsa <<< "${{ secrets.SSH_PASSPHRASE }}"
|
ssh -i ~/.ssh/id_rsa root@213.95.90.157 'echo SSH connection successful'
|
||||||
|
echo " Running Ansible Playbook..."
|
||||||
|
|
||||||
- name: Run Ansible deployment
|
- name: Run Ansible deployment
|
||||||
run: |
|
run: |
|
||||||
if [ -n "$SSH_PASSPHRASE" ]; then
|
ansible-playbook -i ansible/inventory.yaml site.yaml
|
||||||
eval "$(ssh-agent -s)"
|
|
||||||
ssh-add ~/.ssh/id_rsa <<< "$SSH_PASSPHRASE"
|
|
||||||
fi
|
|
||||||
ansible-playbook -i ansible/inventory.yaml site.yaml
|
|
||||||
Reference in New Issue
Block a user