handle existing vault removal
All checks were successful
Deploy Containers / Prepare (push) Successful in 4s
All checks were successful
Deploy Containers / Prepare (push) Successful in 4s
This commit is contained in:
@@ -19,7 +19,6 @@ jobs:
|
|||||||
- name: Run extraction script
|
- name: Run extraction script
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.VAULT_PASS }}" > ~/.vault_pass.txt
|
echo "${{ secrets.VAULT_PASS }}" > ~/.vault_pass.txt
|
||||||
rm host_vars/all.template.yml
|
|
||||||
python3 scripts/extract_to_template.py
|
python3 scripts/extract_to_template.py
|
||||||
|
|
||||||
- name: Create PR
|
- name: Create PR
|
||||||
|
|||||||
@@ -5,12 +5,13 @@ host_vars_path = os.path.abspath('host_vars')
|
|||||||
file_contents = ""
|
file_contents = ""
|
||||||
|
|
||||||
if os.path.exists(host_vars_path):
|
if os.path.exists(host_vars_path):
|
||||||
|
if os.path.exists(os.path.join(host_vars_path, 'all.template.yml')):
|
||||||
|
os.remove(os.path.join(host_vars_path, 'all.template.yml'))
|
||||||
|
|
||||||
vaults = os.listdir(host_vars_path)
|
vaults = os.listdir(host_vars_path)
|
||||||
|
|
||||||
print(vaults)
|
|
||||||
for vault in vaults:
|
for vault in vaults:
|
||||||
vault_path = os.path.join(host_vars_path, vault)
|
vault_path = os.path.join(host_vars_path, vault)
|
||||||
print(f'ansible-vault decrypt "{vault_path}" --vault-password-file ~/.vault_pass.txt')
|
|
||||||
vault_contents = subprocess.run(f'ansible-vault decrypt "{vault_path}" --vault-password-file ~/.vault_pass.txt --output -', shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
vault_contents = subprocess.run(f'ansible-vault decrypt "{vault_path}" --vault-password-file ~/.vault_pass.txt --output -', shell=True, universal_newlines=True, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL)
|
||||||
stdout = vault_contents.stdout.strip().splitlines()
|
stdout = vault_contents.stdout.strip().splitlines()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user