make sure variables are defined before parsing value

This commit is contained in:
2024-07-22 15:51:13 +02:00
parent 7bcc2f2ff6
commit bff17f9de4
2 changed files with 18 additions and 5 deletions

View File

@@ -12,6 +12,10 @@
- mysql is defined - mysql is defined
- mysql == true - mysql == true
- import_tasks: install_postgres.yml - import_tasks: install_postgres.yml
when: postgres == true when:
- postgres is defined
- postgres == true
- import_tasks: install_redis.yml - import_tasks: install_redis.yml
when: redis == true when:
- redis is defined
- redis == true

View File

@@ -6,7 +6,10 @@
- block: - block:
- include_tasks: install_unbound.yml - include_tasks: install_unbound.yml
- include_tasks: configure_unbound_snmpd.yml - include_tasks: configure_unbound_snmpd.yml
when: unbound == true and powerdns_recursor != true when:
- unbound is defined
- unbound == true
- powerdns is not defined or powerdns_recursor != true
- name: nameserver | unbound | disable systemd-resolved - name: nameserver | unbound | disable systemd-resolved
include_tasks: disable-systemd-resolved.yml include_tasks: disable-systemd-resolved.yml
@@ -15,12 +18,18 @@
- block: - block:
- include_tasks: install_bind.yml - include_tasks: install_bind.yml
- include_tasks: configure_bind_snmpd.yml - include_tasks: configure_bind_snmpd.yml
when: bind == true and powerdns_auth != true when:
- bind is defined
- bind == true
- powerdns_auth is not defined or powerdns_auth != true
- block: - block:
- include_tasks: install_powerdns_recursor.yml - include_tasks: install_powerdns_recursor.yml
- include_tasks: configure_powerdns_recursor_snmpd.yml - include_tasks: configure_powerdns_recursor_snmpd.yml
when: powerdns_recursor == true and unbound != true when:
- powerdns_recursor is defined
- powerdns_recursor == true
- unbound is not defined or unbound != true
rescue: rescue:
- set_fact: task_failed=true - set_fact: task_failed=true