130 lines
4.5 KiB
YAML
130 lines
4.5 KiB
YAML
---
|
|
# hashistack configuration merging for nomad
|
|
- name: "Nomad | Merge stringified configuration"
|
|
vars:
|
|
_config_to_merge: "{{ hashicorp_nomad_configuration_string }}"
|
|
ansible.builtin.set_fact:
|
|
hashicorp_nomad_configuration: "{{
|
|
hashicorp_nomad_configuration |
|
|
combine(_config_to_merge|from_yaml, recursive=true)
|
|
}}"
|
|
when:
|
|
- hashicorp_nomad_configuration_string is defined
|
|
- "'nomad_servers' in group_names"
|
|
|
|
- name: "Nomad | Merge addresses configuration"
|
|
vars:
|
|
_config_to_merge: "{{ nomad_address_configuration }}"
|
|
ansible.builtin.set_fact:
|
|
hashicorp_nomad_configuration: "{{
|
|
hashicorp_nomad_configuration |
|
|
combine(_config_to_merge, recursive=true)
|
|
}}"
|
|
when: nomad_address_configuration is defined
|
|
|
|
- name: "Nomad | Merge consul integration configuration"
|
|
when:
|
|
- enable_consul | bool
|
|
- 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:
|
|
hashicorp_nomad_configuration: "{{
|
|
hashicorp_nomad_configuration |
|
|
combine(_config_to_merge, recursive=true)
|
|
}}"
|
|
|
|
- name: "Nomad | Merge TLS configuration"
|
|
vars:
|
|
_config_to_merge:
|
|
tls: "{{ nomad_tls_configuration }}"
|
|
ansible.builtin.set_fact:
|
|
hashicorp_nomad_configuration: "{{
|
|
hashicorp_nomad_configuration |
|
|
combine(_config_to_merge, recursive=true)
|
|
}}"
|
|
when: nomad_enable_tls
|
|
|
|
- name: "Nomad | Merge plugin configuration"
|
|
vars:
|
|
_config_to_merge:
|
|
plugin: "{{
|
|
nomad_driver_configuration |
|
|
combine(nomad_driver_extra_configuration, recursive=true)
|
|
}}"
|
|
ansible.builtin.set_fact:
|
|
hashicorp_nomad_configuration: "{{
|
|
hashicorp_nomad_configuration |
|
|
combine(_config_to_merge, recursive=true)
|
|
}}"
|
|
when: "'nomad_clients' in group_names"
|
|
|
|
- name: "Nomad | Merge extra configuration settings"
|
|
vars:
|
|
_config_to_merge: "{{ nomad_extra_configuration }}"
|
|
ansible.builtin.set_fact:
|
|
hashicorp_nomad_configuration: "{{
|
|
hashicorp_nomad_configuration |
|
|
combine(_config_to_merge, recursive=true)
|
|
}}"
|
|
when: nomad_extra_configuration is defined
|
|
|
|
- name: "Print nomad configuration"
|
|
ansible.builtin.debug:
|
|
msg: "{{ hashicorp_nomad_configuration }}"
|