ci: add Ansible deploy step with image_tag; update inventory IP
CI / smoke-test (push) Failing after 20s
CI / smoke-test (push) Failing after 20s
This commit is contained in:
@@ -60,3 +60,14 @@ jobs:
|
|||||||
docker push mikhaillobanov/devops-platform:latest
|
docker push mikhaillobanov/devops-platform:latest
|
||||||
docker push mikhaillobanov/devops-platform:${GITHUB_SHA}
|
docker push mikhaillobanov/devops-platform:${GITHUB_SHA}
|
||||||
|
|
||||||
|
|
||||||
|
- name: Deploy via Ansible
|
||||||
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||||
|
env:
|
||||||
|
VM_TEST_SSH_KEY: ${{ secrets.VM_TEST_SSH_KEY }}
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "$VM_TEST_SSH_KEY" > ~/.ssh/id_rsa
|
||||||
|
chmod 600 ~/.ssh/id_rsa
|
||||||
|
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa root@87.242.118.200 \
|
||||||
|
"cd /root/devops-platform && ansible-playbook -i ansible/inventory.ini ansible/playbooks/deploy_app.yml -e image_tag=${GITHUB_SHA}"
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
[targets]
|
[targets]
|
||||||
ansible-target ansible_host=178.154.209.109 ansible_user=root ansible_ssh_private_key_file=/root/.ssh/id_rsa
|
ansible-target ansible_host=158.160.223.53 ansible_user=root ansible_ssh_private_key_file=/root/.ssh/id_rsa
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
become: true
|
become: true
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
deploy_image: "mikhaillobanov/devops-platform:latest"
|
deploy_image: "mikhaillobanov/devops-platform:{{ image_tag | default('latest') }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Create application directory
|
- name: Create application directory
|
||||||
|
|||||||
Reference in New Issue
Block a user