diff --git a/.github/workflows/infra.yml b/.github/workflows/infra.yml index 9e1557a..73b026f 100644 --- a/.github/workflows/infra.yml +++ b/.github/workflows/infra.yml @@ -1,12 +1,11 @@ name: Configure Watchtower on: - workflow_call: - secrets: - SSH_DEVOPS_KEY_PRIVATE: - required: true workflow_dispatch: - + inputs: + TARGET_HOST: + type: string + required: true jobs: ansible: runs-on: ubuntu-latest @@ -17,7 +16,7 @@ jobs: - name: Add SSH Keys run: | cat << EOF > devops-key - ${{ secrets.SSH_DEVOPS_KEY_PRIVATE }} + ${{ secrets.SSH_PRIVATE_KEY }} EOF - name: Update devops private key permissions run: | @@ -25,6 +24,13 @@ jobs: - name: Install Ansible run: | pip install ansible + + - name: Adding or Override Ansible inventory File + run: | + cat << EOF > ./inventory.ini + [webservers] + ${{ inputs.TARGET_HOST }} + EOF - name: Adding or Override Ansible Config File run: | @@ -41,4 +47,5 @@ jobs: - name: Run main playbook run: | - ANSIBLE_CONFIG=ansible.cfg ansible-playbook main.yml \ No newline at end of file + ANSIBLE_CONFIG=ansible.cfg ansible-playbook main.yml +