diff --git a/.gitea/workflows/yamllint.yml b/.gitea/workflows/yamllint.yml index f5a516b..4c821b4 100644 --- a/.gitea/workflows/yamllint.yml +++ b/.gitea/workflows/yamllint.yml @@ -38,18 +38,21 @@ jobs: apt-get update && apt-get install -y python3 python3-pip openssh-client bash git 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 \ No newline at end of file