:erge branch 'main' of https://dns.s-martika.com/smartika/Wordpress-Ansible
This commit is contained in:
Robert Ose
2025-12-16 12:33:05 +01:00

View File

@@ -39,17 +39,20 @@ jobs:
pip3 install --upgrade pip
pip3 install ansible
- name: Setup SSH
- name: Setup SSH key with passphrase
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
printf "%s\n" "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
ssh-keyscan -H 213.95.90.157 >> ~/.ssh/known_hosts
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa <<< "${{ secrets.SSH_PASSPHRASE }}"
- name: Test SSH connection
run: |
ssh -i ~/.ssh/id_rsa -o StrictHostKeyChecking=yes root@213.95.90.157 'echo SSH OK'
- name: Run Ansible deployment
run: ansible-playbook -i ansible/inventory.yaml site.yaml
run: |
if [ -n "$SSH_PASSPHRASE" ]; then
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa <<< "$SSH_PASSPHRASE"
fi
ansible-playbook -i ansible/inventory.yaml site.yaml