feat(Ansible): Consul make variables configurable
[csit.git] / fdio.infra.ansible / roles / consul / templates / base.hcl.j2
1 node_name = "{{ consul_node_name }}"
2 datacenter = "{{ consul_datacenter }}"
3
4 bind_addr = "{{ consul_bind_addr }}"
5 client_addr = "{{ consul_client_addr }}"
6 data_dir = "{{ consul_data_dir }}"
7
8 enable_syslog = {{ consul_enable_syslog | bool | lower }}
9 enable_debug = {{ consul_enable_debug | bool | lower }}
10 disable_update_check = {{ consul_disable_update_check | bool | lower }}
11 log_level = "{{ consul_log_level }}"
12
13 server = {{ consul_node_server | bool | lower }}
14 encrypt = "{{ consul_encrypt }}"
15 {% if consul_node_server | bool == True %}
16 bootstrap_expect = {{ consul_bootstrap_expect }}
17 verify_incoming = {{ consul_verify_incoming | bool | lower }}
18 verify_outgoing = {{ consul_verify_outgoing | bool | lower }}
19 verify_server_hostname = {{ consul_vefify_server_hostname | bool | lower }}
20 ca_file = "{{ consul_ca_file }}"
21 cert_file = "{{ consul_cert_file }}"
22 key_file = "{{ consul_key_file }}"
23 auto_encrypt {
24   allow_tls = {{ consul_allow_tls | bool | lower }}
25 }
26 {% else %}
27 verify_incoming = {{ consul_verify_incoming | bool | lower }}
28 verify_outgoing = {{ consul_verify_outgoing | bool | lower }}
29 verify_server_hostname = {{ consul_vefify_server_hostname | bool | lower }}
30 ca_file = "{{ consul_ca_file }}"
31 auto_encrypt {
32   tls = {{ consul_allow_tls | bool | lower }}
33 }
34 {% endif %}
35 {% if consul_retry_join | bool -%}
36 retry_join = [ {% for ip_port in consul_retry_servers -%} "{{ ip_port }}"{% if not loop.last %}, {% endif %}{%- endfor -%} ]
37 {%- endif %}
38
39 {% if consul_ui_config -%}
40 ui_config {
41 {% for key, value in consul_ui_config.items() %}
42   {%- if value|bool %}
43   {{ key }} = {{ value | bool | lower }}
44   {%- elif value|string or value == "" %}
45   {{ key }} = "{{ value }}"
46   {%- else %}
47   {{ key }} = {{ value }}
48   {%- endif %}
49 {% endfor %}
50
51 }
52 {%- endif %}
53
54 {% if consul_recursors -%}
55 recursors = [ {% for server in consul_recursors -%} "{{ server }}"{% if not loop.last %}, {% endif %}{%- endfor -%} ]
56 {%- endif %}