Assert all environment variables are not empty.

This commit is contained in:
yohan 2023-10-22 01:01:19 +02:00
parent 900cefc119
commit 56fc8f188f
2 changed files with 18 additions and 13 deletions

View File

@ -12,20 +12,19 @@
with_items:
- KEY
- DOC_KEY
- name: Assert environment variable is not empty
ansible.builtin.include_tasks: "tasks/assert_env_var_not_empty.yml"
with_items:
- OS_AUTH_URL
- OS_IDENTITY_API_VERSION
- OS_TENANT_NAME
- OS_USERNAME
- OS_PASSWORD
- OS_REGION_NAME
- SECRETS_ARCHIVE_PASSPHRASE
- DUPLICITY_PASSPHRASE
- name: Assert SECRETS_ARCHIVE_PASSPHRASE environment variable is set
ansible.builtin.assert:
that:
- lookup('env','SECRETS_ARCHIVE_PASSPHRASE') | length > 0
msg: "SECRETS_ARCHIVE_PASSPHRASE environment variable must be set"
- name: Assert OS_AUTH_URL environment variable is set
ansible.builtin.assert:
that:
- lookup('env','OS_AUTH_URL') | length > 0
msg: "OS_AUTH_URL environment variable must be set"
- name: Download secrets.tar.gz.enc
ansible.builtin.get_url:
url: "https://{{ CLOUD_SERVER }}/s/{{ KEY }}/download?path=%2F&files=secrets.tar.gz.enc"

View File

@ -0,0 +1,6 @@
---
- name: Assert {{ item }} environment variable is set
ansible.builtin.assert:
that:
- lookup('env','{{ item }}') | length > 0
msg: "{{ item }} environment variable must be set"