feat(cd): Added ansible

This commit is contained in:
Black_Raven committed 2026-08-16 20:30:18 +03:00
1 parent e587346267
commit 9bf23d55d0
2 files changed
+36

No files matched your search

+21
View File
@@ -51,3 +51,24 @@ jobs:
labels: ${{ steps.tags.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
deploy:
needs: docker-build-and-push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Ansible
run: apt-get update && apt-get install -y ansible
- name: Set up SSH key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
- name: Trust server host key
run: |
ssh-keyscan -H ${{ secrets.SERVER_IP }} >> ~/.ssh/known_hosts
- name: Run Ansible playbook
run: |
ansible-playbook -i "${{ secrets.SERVER_IP }}," ansible/restart_compose.yml \
--user "${{ secrets.SERVER_USER }}" \
--private-key ~/.ssh/deploy_key