From 9c4df3440d22803e206122dfb3604c2221f512ef Mon Sep 17 00:00:00 2001 From: "Klaus @ LambdaClass" <18153834+klaus993@users.noreply.github.com> Date: Fri, 12 Jan 2024 19:34:06 -0300 Subject: [PATCH] Fix Ansible scripts to work with production deployment (#403) * Update inventory.yaml * Update deployment.yaml * Update deploy-testing.yaml * Update deploy-production.yaml * Update deployment.yaml --- .github/workflows/deploy-production.yaml | 1 + .github/workflows/deploy-testing.yaml | 1 + ansible/inventory.yaml | 2 +- ansible/playbooks/deployment.yaml | 4 ++-- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-production.yaml b/.github/workflows/deploy-production.yaml index 2ec86dce..5dbb0348 100644 --- a/.github/workflows/deploy-production.yaml +++ b/.github/workflows/deploy-production.yaml @@ -49,6 +49,7 @@ jobs: PROVER_STORAGE: ${{ vars.PROVER_STORAGE }} ANSIBLE_SSH_PKEY_DIR: "./id_ed25519_production" TS_HOST: ${{ vars.SSH_HOST }} + TS_USER: ${{ vars.TS_USER }} GIT_BRANCH: ${{ github.head_ref || github.ref_name }} ANSIBLE_STDOUT_CALLBACK: "yaml" NEWRELIC_KEY: ${{ secrets.NEWRELIC_KEY }} diff --git a/.github/workflows/deploy-testing.yaml b/.github/workflows/deploy-testing.yaml index 7fbf8538..7b8d8c84 100644 --- a/.github/workflows/deploy-testing.yaml +++ b/.github/workflows/deploy-testing.yaml @@ -59,6 +59,7 @@ jobs: PROVER_STORAGE: ${{ vars.PROVER_STORAGE }} ANSIBLE_SSH_PKEY_DIR: "~/.ssh/id_ed25519" TS_HOST: ${{ vars.TS_HOST }} + TS_USER: ${{ vars.TS_USER }} GIT_BRANCH: ${{ github.head_ref || github.ref_name }} ANSIBLE_STDOUT_CALLBACK: "yaml" ENABLE_MAINNET_SYNC: "true" diff --git a/ansible/inventory.yaml b/ansible/inventory.yaml index 76190980..bd1507d2 100644 --- a/ansible/inventory.yaml +++ b/ansible/inventory.yaml @@ -2,6 +2,6 @@ webservers: hosts: starknet_testing: ansible_host: "{{ lookup('ansible.builtin.env', 'TS_HOST') }}" - ansible_user: dev + ansible_user: "{{ lookup('ansible.builtin.env', 'TS_USER') }}" ansible_python_interpreter: /usr/bin/python3 ansible_ssh_private_key_file: "{{ lookup('ansible.builtin.env', 'ANSIBLE_SSH_PKEY_DIR') }}" diff --git a/ansible/playbooks/deployment.yaml b/ansible/playbooks/deployment.yaml index 97a38904..c2a3455b 100644 --- a/ansible/playbooks/deployment.yaml +++ b/ansible/playbooks/deployment.yaml @@ -4,14 +4,14 @@ gather_facts: false any_errors_fatal: true become: true - become_user: dev + become_user: "{{ lookup('ansible.builtin.env', 'TS_USER') }}" pre_tasks: - name: Delete tmp repo file: state: absent - path: /home/dev/tmp/stark_compass_explorer + path: "/home/{{ lookup('ansible.builtin.env', 'TS_USER') }}/tmp/stark_compass_explorer" - name: Clone repo in tmp dir ansible.builtin.git: