diff --git a/.gitea/workflows/yamllint.yml b/.gitea/workflows/yamllint.yml index 130cbbb..9ffa266 100644 --- a/.gitea/workflows/yamllint.yml +++ b/.gitea/workflows/yamllint.yml @@ -39,14 +39,24 @@ jobs: pip3 install --upgrade pip 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: | - echo " Checking SSH key setup..." - head -5 ~/.ssh/id_rsa | cat -v - echo " Testing SSH connection..." - ssh -i ~/.ssh/id_rsa root@213.95.90.157 'echo SSH connection successful' - echo " Running Ansible Playbook..." + mkdir -p ~/.ssh + chmod 700 ~/.ssh - - 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: | - ansible-playbook -i ansible/inventory.yaml site.yaml \ No newline at end of file + ansible-playbook -i ansible/inventory.yaml site.yaml \ No newline at end of file