Skip to content

Commit 4fc9cbc

Browse files
committedDec 6, 2024
fix CD
1 parent 2d34ba6 commit 4fc9cbc

File tree

2 files changed

+38
-17
lines changed

2 files changed

+38
-17
lines changed
 

‎.forgejo/workflows/ansibleCD.yml

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ jobs:
1111
- name: Checkout repository
1212
uses: actions/checkout@v4
1313

14-
- name: Debug Repository Contents
15-
run: |
16-
pwd
17-
ls -R
18-
1914
- name: Fetch all history for git diff
2015
run: git fetch --depth=2
2116

@@ -89,12 +84,49 @@ jobs:
8984
;;
9085
esac
9186
echo "Deploying to $target_host for folder $folder"
87+
echo "target_host=$target_host" >> $GITHUB_ENV
88+
echo "folder=$folder" >> $GITHUB_ENV
9289
done
9390
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+
94126
- name: Run Ansible Playbook
95127
uses: docker://mafyuh/ansible-bws:v1.0.3
96128
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 }}"
98130
env:
99131
BWS_ACCESS_TOKEN: ${{ secrets.BWS_ACCESS_TOKEN }}
100132
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}

‎ansible/hosts.ini

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)