--- # task/merge_variables file for nomad - name: "Nomad | Merge stringified configuration" vars: _config_to_merge: "{{ nomad_configuration_string }}" ansible.builtin.set_fact: nomad_configuration: "{{ nomad_configuration | combine(_config_to_merge|from_yaml, recursive=true) }}" - name: "Nomad | Merge addresses configuration" vars: _config_to_merge: "{{ nomad_address_configuration }}" ansible.builtin.set_fact: nomad_configuration: "{{ nomad_configuration | combine(_config_to_merge, recursive=true) }}" - name: "Nomad | Merge consul integration configuration" when: - nomad_enable_consul_integration | bool block: - name: "Nomad | Merge consul tls configuration" when: - nomad_consul_integration_configuration.ssl is defined - nomad_consul_integration_configuration.ssl | bool block: - name: "Nomad | Merge consul default client configuration" vars: _config_to_merge: "{{ nomad_consul_integration_tls_configuration }}" ansible.builtin.set_fact: nomad_consul_integration_configuration: "{{ nomad_consul_integration_configuration | combine(_config_to_merge, recursive=true) }}" - name: "Nomad | Merge consul configuration for nomad servers" when: - nomad_enable_server block: - name: "Nomad | Merge consul default server configuration" vars: _config_to_merge: "{{ nomad_consul_integration_server_configuration }}" ansible.builtin.set_fact: nomad_consul_integration_configuration: "{{ nomad_consul_integration_configuration | combine(_config_to_merge, recursive=true) }}" - name: "Nomad | Merge consul configuration for nomad clients" when: - nomad_enable_client block: - name: "Nomad | Merge consul default client configuration" vars: _config_to_merge: "{{ nomad_consul_integration_client_configuration }}" ansible.builtin.set_fact: nomad_consul_integration_configuration: "{{ nomad_consul_integration_configuration | combine(_config_to_merge, recursive=true) }}" - name: "Nomad | Merge consul tls client configuration" vars: _config_to_merge: "{{ nomad_consul_integration_client_tls_configuration }}" ansible.builtin.set_fact: nomad_consul_integration_configuration: "{{ nomad_consul_integration_configuration | combine(_config_to_merge, recursive=true) }}" when: - nomad_consul_integration_configuration.ssl is defined - nomad_consul_integration_configuration.ssl | bool - name: "Nomad | Merge consul block into main configuration" vars: _config_to_merge: consul: "{{ nomad_consul_integration_configuration }}" ansible.builtin.set_fact: nomad_configuration: "{{ nomad_configuration | combine(_config_to_merge, recursive=true) }}" - name: "Nomad | Merge TLS configuration" when: nomad_enable_tls | bool block: - name: "Nomad | Merge TLS configuration" vars: _config_to_merge: tls: "{{ nomad_tls_configuration }}" ansible.builtin.set_fact: nomad_configuration: "{{ nomad_configuration | combine(_config_to_merge, recursive=true) }}" - name: "Nomad | Add certificates directory to extra_files_dir" ansible.builtin.set_fact: nomad_extra_files_list: "{{ nomad_extra_files_list + nomad_certificates_extra_files_dir | unique | sort }}" - name: "Nomad | Merge plugin configuration" vars: _config_to_merge: plugin: "{{ nomad_driver_configuration | combine(nomad_driver_extra_configuration, recursive=true) }}" ansible.builtin.set_fact: nomad_configuration: "{{ nomad_configuration | combine(_config_to_merge, recursive=true) }}" when: nomad_enable_client | bool - name: "Nomad | Merge extra configuration settings" vars: _config_to_merge: "{{ nomad_extra_configuration }}" ansible.builtin.set_fact: nomad_configuration: "{{ nomad_configuration | combine(_config_to_merge, recursive=true) }}" - name: "Nomad | Merge log to file configuration" vars: _config_to_merge: "{{ nomad_log_to_file_configuration }}" ansible.builtin.set_fact: nomad_configuration: "{{ nomad_configuration | combine(_config_to_merge, recursive=true) }}" when: nomad_enable_log_to_file - name: "Nomad | Merge telemetry configuration" vars: _config_to_merge: telemetry: "{{ nomad_telemetry_configuration }}" ansible.builtin.set_fact: nomad_configuration: "{{ nomad_configuration | combine(_config_to_merge, recursive=true) }}"