Skip to content

Commit

Permalink
Update infra.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jackkweyunga committed Dec 7, 2022
1 parent 0530edd commit 6cee0e0
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/infra.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -17,14 +16,21 @@ 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: |
chmod 400 devops-key
- 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: |
Expand All @@ -41,4 +47,5 @@ jobs:
- name: Run main playbook
run: |
ANSIBLE_CONFIG=ansible.cfg ansible-playbook main.yml
ANSIBLE_CONFIG=ansible.cfg ansible-playbook main.yml

0 comments on commit 6cee0e0

Please sign in to comment.