-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
G. Roggemans
committed
Jun 18, 2017
1 parent
dd042fa
commit 8828144
Showing
6 changed files
with
152 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,26 @@ | ||
# Base Nomad configuration, based on: | ||
# https://www.nomadproject.io/docs/cluster/bootstrapping.html | ||
|
||
# Name the region, if omitted, the default "global" region will be used. | ||
name = "{{ nomad_node_name }}" | ||
region = "{{ nomad_region }}" | ||
|
||
# Name the datacenter, if omitted, the default "dc1" datacenter will be used. | ||
datacenter = "{{ nomad_datacenter }}" | ||
|
||
# Persist data to a location that will survive a machine reboot. | ||
data_dir = "{{ nomad_data_dir }}" | ||
enable_debug = {{ nomad_debug | bool | lower }} | ||
disable_update_check = {{ nomad_disable_update_check | bool | lower }} | ||
|
||
# Bind to all addresses so that the Nomad agent is available | ||
# both on loopback and externally. | ||
bind_addr = "{{ nomad_bind_address }}" | ||
|
||
# Advertise an accessible IP address so the server is reachable by | ||
# other servers and clients. The IPs can be materialized by Terraform | ||
# or be replaced by an init script. | ||
|
||
advertise { | ||
http = "{{ nomad_advertise_address }}:4646" | ||
rpc = "{{ nomad_advertise_address }}:4647" | ||
serf = "{{ nomad_advertise_address }}:4648" | ||
http = "{{ nomad_advertise_address }}" | ||
rpc = "{{ nomad_advertise_address }}" | ||
serf = "{{ nomad_advertise_address }}" | ||
} | ||
ports { | ||
http = {{ nomad_ports['http'] }} | ||
rpc = {{ nomad_ports['rpc'] }} | ||
serf = {{ nomad_ports['serf'] }} | ||
} | ||
|
||
# Send Nomad telemetry to statsite | ||
|
||
# telemetry { | ||
# statsite_address = "${var.statsite}" | ||
# disable_hostname = true | ||
# } | ||
data_dir = "{{ nomad_data_dir }}" | ||
|
||
# Enable debug endpoints | ||
enable_debug = true | ||
log_level = "{{ nomad_log_level }}" | ||
enable_syslog = {{ nomad_syslog_ enable | bool | lower }} | ||
|
||
# Graceful leave on SIGTERM | ||
leave_on_terminate = true | ||
leave_on_terminate = {{ nomad_leave_on_terminate | bool | lower }} | ||
leave_on_interrupt = {{ nomad_leave_on_interrupt | bool | lower }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,29 @@ | ||
# Nomad client configuration | ||
# Based on: https://www.nomadproject.io/docs/cluster/bootstrapping.html | ||
client { | ||
enabled = {{ nomad_node_client | bool | lower }} | ||
|
||
# Enable the client | ||
node_class = "{{ nomad_node_class }}" | ||
no_host_uuid = {{ nomad_no_host_uuid | bool | lower }} | ||
|
||
client { | ||
enabled = true | ||
{% if nomad_use_consul == False %} | ||
#use dns discovery to find nomad service directly instead of native consul | ||
servers = ["nomad.service.consul:4647"] | ||
{% endif %} | ||
servers = [ | ||
{% for server in _nomad_servers -%} | ||
{% set comma = joiner(",") %} | ||
{{ comma }}"{{ hostvars[server]['nomad_advertise_address'] | ipwrap }}" | ||
{%- endfor -%} ] | ||
|
||
max_kill_timeout = "{{ nomad_max_kill_timeout }}" | ||
|
||
network_speed = {{ nomad_network_speed }} | ||
cpu_total_compute = {{ nomad_cpu_total_compute }} | ||
|
||
gc_interval = "{{ nomad_gc_interval }}" | ||
gc_disk_usage_threshold = {{ nomad_gc_disk_usage_threshold }} | ||
gc_inode_usage_threshold = {{ nomad_gc_inode_usage_threshold }} | ||
gc_parallel_destroys = {{ nomad_gc_parallel_destroys }} | ||
|
||
reserved { | ||
cpu = {{ nomad_reserved['cpu'] }} | ||
memory = {{ nomad_reserved['memory'] }} | ||
disk = {{ nomad_reserved['disk'] }} | ||
ports = {{ nomad_reserved['ports'] }} | ||
} | ||
} | ||
# Increase log verbosity | ||
log_level = "{{nomad_log_level}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,36 @@ | ||
{% set comma = joiner(",") %} | ||
{% set lbracket = "[" %} | ||
{% set rbracket = "]" %} | ||
{% set quote = '"' %} | ||
|
||
# Enable the server | ||
server { | ||
enabled = true | ||
bootstrap_expect = {{ nomad_server_count }} | ||
{% if nomad_use_consul == False %} | ||
start_join= {{ lbracket }}{% for host in groups['cluster_nodes'] %}{% if hostvars[inventory_hostname]['ansible_default_ipv4']['address'] != hostvars[host]['ansible_default_ipv4']['address'] %}{{ comma() }}{{ quote }}{{ hostvars[host]['ansible_default_ipv4']['address'] }}{{ quote }}{% endif %} | ||
{% endfor %}{{ rbracket }} | ||
retry_join= {{ lbracket }}{% for host in groups['cluster_nodes'] %}{% if hostvars[inventory_hostname]['ansible_default_ipv4']['address'] != hostvars[host]['ansible_default_ipv4']['address'] %}{{ comma() }}{{ quote }}{{ hostvars[host]['ansible_default_ipv4']['address'] }}{{ quote }}{% endif %} | ||
{% endfor %}{{ rbracket }} | ||
retry_interval = "15s" | ||
{% endif %} | ||
enabled = {{ nomad_node_server | bool | lower }} | ||
|
||
bootstrap_expect = {{ _nomad_servers | count }} | ||
|
||
{% if nomad_retry_join | bool -%} | ||
retry_join = [ | ||
{% for server in _nomad_servers -%} | ||
{% set comma = joiner(",") %} | ||
{{ comma }}"{{ hostvars[server]['nomad_advertise_address'] | ipwrap }}" | ||
{%- endfor -%} ] | ||
retry_max = {{ nomad_retry_max }} | ||
retry_interval = "{{ nomad_retry_interval }}" | ||
{% else %} | ||
start_join = [ | ||
{% for server in _nomad_servers -%} | ||
{% set comma = joiner(",") %} | ||
{{ comma }}"{{ hostvars[server]['nomad_advertise_address'] | ipwrap }}" | ||
{%- endfor -%} ] | ||
{%- endif %} | ||
|
||
rejoin_after_leave = {{ nomad_rejoin_after_leave | bool | lower }} | ||
|
||
enabled_schedulers = [ | ||
{% for scheduler in nomad_enabled_schedulers -%} | ||
{% set comma = joiner(",") %} | ||
{{ comma }}"{{ scheduler }}" | ||
{%- endfor -%} ] | ||
num_schedulers = {{ nomad_num_schedulers }} | ||
|
||
node_gc_threshold = "{{ nomad_node_gc_threshold }}" | ||
eval_gc_threshold = "{{ nomad_eval_gc_threshold }}" | ||
job_gc_threshold = "{{ nomad_job_gc_threshold }}" | ||
|
||
encrypt = "{{ nomad_encrypt }}" | ||
} | ||
# Increase log verbosity | ||
log_level = "{{nomad_log_level}}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Pure internal helper variables | ||
|
||
_nomad_node_client: "{{ (nomad_node_role == 'client') or (nomad_node_role == 'both') }}" | ||
_nomad_node_server: "{{ (nomad_node_role == 'server') or (nomad_node_role == 'both') }}" |