diff --git a/gen_bootstrap.yml b/gen_bootstrap.yml index b62900c..4c402d5 100755 --- a/gen_bootstrap.yml +++ b/gen_bootstrap.yml @@ -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" diff --git a/tasks/assert_env_var_not_empty.yml b/tasks/assert_env_var_not_empty.yml new file mode 100755 index 0000000..1b73ef4 --- /dev/null +++ b/tasks/assert_env_var_not_empty.yml @@ -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"