|
11 | 11 | - name: Checkout repository
|
12 | 12 | uses: actions/checkout@v4
|
13 | 13 |
|
14 |
| - - name: Debug Repository Contents |
15 |
| - run: | |
16 |
| - pwd |
17 |
| - ls -R |
18 |
| -
|
19 | 14 | - name: Fetch all history for git diff
|
20 | 15 | run: git fetch --depth=2
|
21 | 16 |
|
@@ -89,12 +84,49 @@ jobs:
|
89 | 84 | ;;
|
90 | 85 | esac
|
91 | 86 | echo "Deploying to $target_host for folder $folder"
|
| 87 | + echo "target_host=$target_host" >> $GITHUB_ENV |
| 88 | + echo "folder=$folder" >> $GITHUB_ENV |
92 | 89 | done
|
93 | 90 |
|
| 91 | + - name: Get Secrets from Bitwarden |
| 92 | + id: bitwarden-secrets |
| 93 | + uses: bitwarden/sm-action@v2 |
| 94 | + with: |
| 95 | + access_token: ${{ secrets.BW_ACCESS_TOKEN }} |
| 96 | + base_url: https://vault.bitwarden.com |
| 97 | + secrets: | |
| 98 | + 267abc49-f755-4c88-a2a8-b23d00503e31 > arrs_host |
| 99 | + e74d1f67-c909-4a2e-b6fc-b23e001dfa4a > ai_host |
| 100 | + 6f9cef86-eb39-4e05-8c5b-b23e001e6170 > arm_host |
| 101 | + 52512c15-b474-42c3-9835-b23e001edf35 > auth_host |
| 102 | + 903364d9-1b29-4b7f-aa66-b23e001f7327 > jf_host |
| 103 | + e4c5d8be-b91f-41ab-8071-b23e00203340 > kasm_host |
| 104 | + 566329f5-5af3-4bcd-b187-b23e00216134 > netboot_host |
| 105 | + fb62a8d1-6dd5-4fab-aff4-b23e0021e215 > npm_host |
| 106 | + 90a16954-45df-49ad-9f45-b23e002273c5 > runner_host |
| 107 | + a5b6fa4b-4643-4f85-988b-b23e00245e2f > ubu_host |
| 108 | +
|
| 109 | + |
| 110 | + - name: Create hosts.ini file |
| 111 | + run: | |
| 112 | + cat <<EOF > ansible/hosts.ini |
| 113 | + [iac] |
| 114 | + arrs.lan ansible_host=${{ steps.bitwarden-secrets.outputs.arrs_host }} |
| 115 | + ai.lan ansible_host=${{ steps.bitwarden-secrets.outputs.ai_host }} |
| 116 | + arm.lan ansible_host=${{ steps.bitwarden-secrets.outputs.arm_host }} ansible_user=ubuntu ansible_port=2424 |
| 117 | + auth.lan ansible_host=${{ steps.bitwarden-secrets.outputs.auth_host }} |
| 118 | + jf.lan ansible_host=${{ steps.bitwarden-secrets.outputs.jf_host }} |
| 119 | + kasm.lan ansible_host=${{ steps.bitwarden-secrets.outputs.kasm_host }} |
| 120 | + netboot.lan ansible_host=${{ steps.bitwarden-secrets.outputs.netboot_host }} |
| 121 | + npm.lan ansible_host=${{ steps.bitwarden-secrets.outputs.npm_host }} |
| 122 | + runner.lan ansible_host=${{ steps.bitwarden-secrets.outputs.runner_host }} |
| 123 | + ubu.lan ansible_host=${{ steps.bitwarden-secrets.outputs.ubu_host }} |
| 124 | + EOF |
| 125 | +
|
94 | 126 | - name: Run Ansible Playbook
|
95 | 127 | uses: docker://mafyuh/ansible-bws:v1.0.3
|
96 | 128 | with:
|
97 |
| - args: ansible-playbook -i ansible/hosts.ini ./ansible/playbooks/deploy-docker.yml --extra-vars "target_host=${{ steps.detect-changes.outputs.target_host }} folder=${{ steps.detect-changes.outputs.folders }}" |
| 129 | + args: ansible-playbook -i ansible/hosts.ini ./ansible/playbooks/deploy-docker.yml --extra-vars "target_host=${{ env.target_host }} folder=${{ env.folder }}" |
98 | 130 | env:
|
99 | 131 | BWS_ACCESS_TOKEN: ${{ secrets.BWS_ACCESS_TOKEN }}
|
100 | 132 | SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
0 commit comments