Funktionsfähig
This commit is contained in:
@@ -39,14 +39,24 @@ jobs:
|
|||||||
pip3 install --upgrade pip
|
pip3 install --upgrade pip
|
||||||
pip3 install ansible
|
pip3 install ansible
|
||||||
|
|
||||||
- name: Setup SSH key with passphrase
|
- name: Setup SSH
|
||||||
|
env:
|
||||||
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
SSH_PASSPHRASE: ${{ secrets.SSH_PASSPHRASE }}
|
||||||
run: |
|
run: |
|
||||||
echo " Checking SSH key setup..."
|
mkdir -p ~/.ssh
|
||||||
head -5 ~/.ssh/id_rsa | cat -v
|
chmod 700 ~/.ssh
|
||||||
echo " Testing SSH connection..."
|
|
||||||
ssh -i ~/.ssh/id_rsa root@213.95.90.157 'echo SSH connection successful'
|
|
||||||
echo " Running Ansible Playbook..."
|
|
||||||
|
|
||||||
- name: Run Ansible deployment
|
echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.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 <<< "$SSH_PASSPHRASE"
|
||||||
|
|
||||||
|
ssh -o BatchMode=yes root@213.95.90.157 "echo SSH OK"
|
||||||
|
|
||||||
|
- name: Run Ansible
|
||||||
run: |
|
run: |
|
||||||
ansible-playbook -i ansible/inventory.yaml site.yaml
|
ansible-playbook -i ansible/inventory.yaml site.yaml
|
||||||
Reference in New Issue
Block a user