Skip to content

Commit

Permalink
Add lookup for vars
Browse files Browse the repository at this point in the history
  • Loading branch information
EMaksy committed Feb 16, 2024
1 parent 4aece22 commit b7db9bd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions roles/containers/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@
AMQP_URL: "{{ amqp_protocol }}://{{ rabbitmq_username }}:{{ rabbitmq_password }}@{{ rabbitmq_host }}/{{ rabbitmq_vhost | urlencode | replace('/', '%2F') }}"
DATABASE_URL: "ecto://{{ wanda_postgres_user }}:{{ wanda_postgres_password }}@{{ wanda_postgres_host }}/{{ wanda_postgres_db }}"

- name: Verify that alerting configuration variables are defined if alerting is enabled
- name: Verify that alerting configuration variables are defined in json configuration if alerting is enabled
ansible.builtin.assert:
that:
- alerting_env is defined
- alerting_env | length > 0
- alerting_env != None
- alerting_env != ""
- "{{ lookup('vars', alerting_env) | length > 0 }}"
- "{{ lookup('vars', alerting_env) != None }}"
- "{{ lookup('vars', alerting_env) != '' }}"

fail_msg: "The variable {{ alerting_env }} needs to be set for alerting to work"
success_msg: "Required variable {{ alerting_env }} is defined"
fail_msg: "{{ alerting_env }} needs to be set in json configuration to enable alerting"
success_msg: "{{ alerting_env }} is set in json configuration"
loop_control:
loop_var: alerting_env
with_items:
Expand Down

0 comments on commit b7db9bd

Please sign in to comment.