Infra: Cleanup Nomad configs
[csit.git] / fdio.infra.ansible / roles / nomad / defaults / main.yaml
1 ---
2 # file: roles/nomad/defaults/main.yaml
3
4 # Prerequisites
5 packages: "{{ packages_base + packages_by_distro[ansible_distribution | lower] + packages_by_arch[ansible_machine] }}"
6 packages_base:
7   - "curl"
8   - "git"
9   - "unzip"
10 packages_by_distro:
11   ubuntu:
12     - []
13 packages_by_arch:
14   aarch64:
15     - []
16   x86_64:
17     - []
18
19 # Package
20 nomad_version: "{{ lookup('env','NOMAD_VERSION') | default('1.0.4', true) }}"
21 nomad_architecture_map:
22   amd64: "amd64"
23   x86_64: "amd64"
24   armv7l: "arm"
25   aarch64: "arm64"
26   32-bit: "386"
27   64-bit: "amd64"
28 nomad_architecture: "{{ nomad_architecture_map[ansible_architecture] }}"
29 nomad_pkg: "nomad_{{ nomad_version }}_linux_{{nomad_architecture}}.zip"
30 nomad_zip_url: "https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version }}_linux_{{nomad_architecture}}.zip"
31 nomad_checksum_file_url: "https://releases.hashicorp.com/nomad/{{ nomad_version }}/nomad_{{ nomad_version}}_SHA256SUMS"
32 nomad_podman_enable: false
33 nomad_podman_version: "{{ lookup('env','NOMAD_PODMAN_VERSION') | default('0.1.0', true) }}"
34 nomad_podman_pkg: "nomad-driver-podman_{{ nomad_podman_version }}_linux_{{nomad_architecture}}.zip"
35 nomad_podman_url: "https://releases.hashicorp.com/nomad-driver-podman/{{ nomad_podman_version }}"
36 nomad_podman_zip_url: "{{ nomad_podman_url }}/{{ nomad_podman_pkg }}"
37 nomad_podman_checksum_file_url: "{{ nomad_podman_url }}/nomad-driver-podman_{{ nomad_podman_version }}_SHA256SUMS"
38
39 # Paths
40 nomad_inst_dir: "/opt"
41 nomad_bin_dir: "/usr/local/bin"
42 nomad_config_dir: "/etc/nomad.d"
43 nomad_data_dir: "/var/nomad"
44 nomad_plugin_dir: "{{ nomad_data_dir }}/plugins"
45 nomad_lockfile: "/var/lock/subsys/nomad"
46 nomad_run_dir: "/var/run/nomad"
47 nomad_ssl_dir: "/etc/nomad.d/ssl"
48
49 # Initialization and startup script templates
50 nomad_restart_handler_state: "restarted"
51
52 # System user and group
53 nomad_group: "nomad"
54 nomad_group_state: "present"
55 nomad_user: "nomad"
56 nomad_user_state: "present"
57
58 # Nomad settings
59 nomad_datacenter: "dc1"
60 nomad_region: "global"
61 nomad_log_level: "INFO"
62 nomad_syslog_enable: true
63 nomad_iface: "{{ lookup('env','NOMAD_IFACE') | default(ansible_default_ipv4.interface, true) }}"
64 nomad_node_name: "{{ inventory_hostname }}"
65 nomad_node_role: "{{ lookup('env','NOMAD_NODE_ROLE') | default('client', true) }}"
66 nomad_leave_on_terminate: true
67 nomad_leave_on_interrupt: false
68 nomad_disable_update_check: true
69 nomad_enable_debug: false
70
71 # Server settings
72 nomad_bootstrap_expect: 2
73 nomad_encrypt: ""
74 nomad_retry_join: true
75 # Specifies how long a node must be in a terminal state before it is garbage
76 # collected and purged from the system.
77 nomad_node_gc_threshold: "24h"
78 # Specifies the interval between the job garbage collections. Only jobs who have
79 # been terminal for at least job_gc_threshold will be collected.
80 nomad_job_gc_interval: "10m"
81 # Specifies the minimum time a job must be in the terminal state before it is
82 # eligible for garbage collection.
83 nomad_job_gc_threshold: "4h"
84 # Specifies the minimum time an evaluation must be in the terminal state before
85 # it is eligible for garbage collection.
86 nomad_eval_gc_threshold: "1h"
87 # Specifies the minimum time a deployment must be in the terminal state before
88 # it is eligible for garbage collection.
89 nomad_deployment_gc_threshold: "1h"
90 nomad_encrypt_enable: "{{ lookup('env','NOMAD_ENCRYPT_ENABLE') | default('false', true) }}"
91 nomad_raft_protocol: 2
92
93 # Client settings
94 nomad_certificates:
95   - src: "{{ file_nomad_ca_pem }}"
96     dest: "{{ nomad_ca_file }}"
97   - src: "{{ file_nomad_client_pem }}"
98     dest: "{{ nomad_cert_file }}"
99   - src: "{{ file_nomad_client_key_pem }}"
100     dest: "{{ nomad_key_file }}"
101 nomad_node_class: ""
102 nomad_no_host_uuid: true
103 nomad_max_kill_timeout: "30s"
104 nomad_gc_interval: "1m"
105 nomad_gc_disk_usage_threshold: 80
106 nomad_gc_inode_usage_threshold: 70
107 nomad_gc_parallel_destroys: 2
108 nomad_reserved:
109   cpu: "{{ nomad_reserved_cpu | default('0', true) }}"
110   memory: "{{ nomad_reserved_memory | default('0', true) }}"
111   disk: "{{ nomad_reserved_disk | default('0', true) }}"
112   ports: "{{ nomad_reserved_ports | default('22', true) }}"
113 nomad_volumes: []
114 nomad_options: {}
115 nomad_meta: {}
116 nomad_chroot_env: false
117 nomad_plugins: {}
118
119 # Addresses
120 nomad_bind_address: "{{ hostvars[inventory_hostname]['ansible_'+ nomad_iface ]['ipv4']['address'] }}"
121 nomad_advertise_address: "{{ hostvars[inventory_hostname]['ansible_' + nomad_iface]['ipv4']['address'] }}"
122
123 # Ports
124 nomad_ports:
125   http: "{{ nomad_ports_http | default('4646', true) }}"
126   rpc: "{{ nomad_ports_rpc | default('4647', true) }}"
127   serf: "{{ nomad_ports_serf | default('4648', true) }}"
128
129 # Servers
130 nomad_group_name: "nomad"
131 nomad_servers: "\
132   {% if nomad_use_consul==false %}\
133     {% set _nomad_servers = [] %}\
134     {% for host in groups[nomad_group_name] %}\
135       {% set _nomad_node_role = hostvars[host]['nomad_node_role'] | default('client', true) %}\
136       {% if ( _nomad_node_role == 'server' or _nomad_node_role == 'both') %}\
137         {% if _nomad_servers.append(host) %}{% endif %}\
138       {% endif %}\
139     {% endfor %}\
140     {{ _nomad_servers }}\
141     {% else %}\
142     []\
143   {% endif %}"
144 nomad_gather_server_facts: false
145
146 # Consul
147 nomad_use_consul: true
148 nomad_consul_address: "localhost:8500"
149 nomad_consul_token: ""
150 nomad_consul_servers_service_name: "nomad"
151 nomad_consul_clients_service_name: "nomad-client"
152 nomad_consul_tags: {}
153
154 # ACLs
155 nomad_acl_enabled: "{{ lookup('env', 'NOMAD_ACL_ENABLED') | default('no', true) }}"
156 nomad_acl_token_ttl: "30s"
157 nomad_acl_policy_ttl: "30s"
158 nomad_acl_replication_token: ""
159
160 # Vault
161 nomad_vault_enabled: "{{ lookup('env', 'NOMAD_VAULT_ENABLED') | default('no', true) }}"
162 nomad_vault_address: "{{ vault_address | default('0.0.0.0', true) }}"
163 nomad_vault_allow_unauthenticated: true
164 nomad_vault_create_from_role: ""
165 nomad_vault_task_token_ttl: ""
166 nomad_vault_ca_file: ""
167 nomad_vault_ca_path: ""
168 nomad_vault_cert_file: ""
169 nomad_vault_key_file: ""
170 nomad_vault_tls_server_name: ""
171 nomad_vault_tls_skip_verify: false
172 nomad_vault_token: ""
173 nomad_vault_namespace: ""
174
175 # Docker
176 nomad_docker_enable: "{{ lookup('env','NOMAD_DOCKER_ENABLE') | default('false', true) }}"
177 nomad_docker_dmsetup: true
178
179 # TLS
180 nomad_tls_enable: true
181 nomad_ca_file: "{{ nomad_ssl_dir }}/ca.pem"
182 nomad_cert_file: "{{ nomad_ssl_dir }}/nomad.pem"
183 nomad_key_file: "{{ nomad_ssl_dir }}/nomad-key.pem"
184 nomad_http: false
185 nomad_rpc: false
186 nomad_rpc_upgrade_mode: false
187 nomad_verify_server_hostname: false
188 nomad_verify_https_client: false
189
190 # Conf - autopilot.hcl
191 nomad_autopilot_cleanup_dead_servers: true
192 nomad_autopilot_last_contact_threshold: "200ms"
193 nomad_autopilot_max_trailing_logs: 250
194 nomad_autopilot_server_stabilization_time: "10s"
195
196 # Telemetry
197 nomad_telemetry: true
198 nomad_telemetry_disable_hostname: false
199 nomad_telemetry_collection_interval: 60s
200 nomad_telemetry_use_node_name: false
201 nomad_telemetry_publish_allocation_metrics: true
202 nomad_telemetry_publish_node_metrics: true
203 nomad_telemetry_prometheus_metrics: true