Skip to content

Commit 33d39fa

Browse files
authored
Add vault file step (#1751)
1 parent fce98ca commit 33d39fa

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.github/workflows/prod-deploy.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,15 @@ jobs:
4646
path: ansible-playbook-airflow
4747
ref: main
4848

49+
- name: Dump vault password to disk
50+
env:
51+
ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
52+
run: |
53+
printf '%s' "${ANSIBLE_VAULT_PASSWORD}" > "$HOME/.vault"
54+
chmod 600 "$HOME/.vault"
55+
4956
- name: Run Ansible Airflow Playbook for Prod
5057
working-directory: ansible-playbook-airflow
5158
run: |
5259
pipenv run ansible-galaxy install -r requirements.yml
53-
pipenv run ansible-playbook -i inventory/prod playbook.yml --tags "jumphost,role::airflow::dags" --vault-id ${{ secrets.ANSIBLE_VAULT_PASSWORD }} -e 'ansible_ssh_port=9229' -e cob_datapipeline_branch=$COB_DATAPIPELINE_BRANCH
60+
pipenv run ansible-playbook -i inventory/prod playbook.yml --tags "jumphost,role::airflow::dags" --vault-password-file "$HOME/.vault" -e 'ansible_ssh_port=9229' -e cob_datapipeline_branch=$COB_DATAPIPELINE_BRANCH

.github/workflows/qa-deploy.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,15 @@ jobs:
4343
path: ansible-playbook-airflow
4444
ref: qa
4545

46+
- name: Dump vault password to disk
47+
env:
48+
ANSIBLE_VAULT_PASSWORD: ${{ secrets.ANSIBLE_VAULT_PASSWORD }}
49+
run: |
50+
printf '%s' "${ANSIBLE_VAULT_PASSWORD}" > "$HOME/.vault"
51+
chmod 600 "$HOME/.vault"
52+
4653
- name: Run Ansible Airflow Playbook for QA
4754
working-directory: ansible-playbook-airflow
4855
run: |
4956
pipenv run ansible-galaxy install -r requirements.yml
50-
pipenv run ansible-playbook -i inventory/qa playbook.yml --tags "jumphost,role::airflow::dags" --vault-id ${{ secrets.ANSIBLE_VAULT_PASSWORD }} -e 'ansible_ssh_port=9229'
57+
pipenv run ansible-playbook -i inventory/qa playbook.yml --tags "jumphost,role::airflow::dags" --vault-password-file "$HOME/.vault" -e 'ansible_ssh_port=9229'

0 commit comments

Comments
 (0)