Skip to content

Commit b0552c5

Browse files
committed
Updates
- Move bootstrap into server config - Remove bootstrap node role - Use node role in startup scripts - Update startup scripts - Update install playbook
1 parent ee4dcc2 commit b0552c5

File tree

8 files changed

+14
-20
lines changed

8 files changed

+14
-20
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,11 @@
195195
## v1.6.0
196196

197197
- Fix install task issue
198+
199+
## v1.6.1
200+
201+
- Move bootstrap into server config
202+
- Remove bootstrap node role
203+
- Use node role in startup scripts
204+
- Update startup scripts
205+
- Update install playbook

examples/vagrant_hosts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
# Do not modify the labels (text appearing between []), however
77

88
[nomad_cluster_nodes]
9-
nomad1.local nomad_node_role=bootstrap ansible_ssh_user=vagrant ansible_ssh_private_key_file=./.vagrant/machines/nomad1/virtualbox/private_key
9+
nomad1.local nomad_node_role=server ansible_ssh_user=vagrant ansible_ssh_private_key_file=./.vagrant/machines/nomad1/virtualbox/private_key
1010
nomad2.local nomad_node_role=server ansible_ssh_user=vagrant ansible_ssh_private_key_file=./.vagrant/machines/nomad2/virtualbox/private_key
1111
nomad3.local nomad_node_role=client ansible_ssh_user=vagrant ansible_ssh_private_key_file=./.vagrant/machines/nomad3/virtualbox/private_key

tasks/install.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
- name: Install Nomad
5151
copy:
5252
src: "{{ role_path }}/files/nomad"
53-
dest: /usr/local/bin/
53+
dest: "{{ nomad_bin_dir }}"
5454
owner: "{{ nomad_user }}"
5555
group: "{{ nomad_group }}"
5656
mode: 0755

templates/bootstrap.hcl.j2

Lines changed: 0 additions & 9 deletions
This file was deleted.

templates/nomad_debian.init.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ DESC="Nomad service discovery framework"
1818
NAME="nomad"
1919
DAEMON="{{ nomad_bin_dir }}/${NAME}"
2020
PIDFILE="{{ nomad_run_dir }}/${NAME}.pid"
21-
DAEMON_ARGS="agent -server -config {{ nomad_config_dir }}/base.hcl -config {{ nomad_config_dir }}/{{ nomad_node_role }}.hcl >> {{ nomad_log_dir }}/$NAME.log 2>&1"
21+
DAEMON_ARGS="agent -{{ nomad_node_role }} -config {{ nomad_config_dir }}/base.hcl -config {{ nomad_config_dir }}/{{ nomad_node_role }}.hcl >> {{ nomad_log_dir }}/$NAME.log 2>&1"
2222
USER="{{ nomad_user }}"
2323
SCRIPTNAME="/etc/init.d/${NAME}"
2424

templates/nomad_systemd.service.j2

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,9 @@ After=basic.target network.target
1616
[Service]
1717
User={{ nomad_user }}
1818
Group={{ nomad_group }}
19-
{% if nomad_node_role == "server" %}
20-
ExecStart={{ nomad_bin_dir }}/nomad agent -server \
19+
ExecStart={{ nomad_bin_dir }}/nomad agent -{{ nomad_node_role }} \
2120
-config={{ nomad_config_dir }}/base.hcl \
2221
-config={{ nomad_config_dir }}/{{ nomad_node_role }}.hcl
23-
{% else %}
24-
ExecStart={{ nomad_bin_dir }}/nomad agent \
25-
-config={{ nomad_config_dir }}/base.hcl \
26-
-config={{ nomad_config_dir }}/{{ nomad_node_role }}.hcl
27-
{% endif %}
2822
ExecReload=/bin/kill -HUP $MAINPID
2923
KillMode=process
3024
Restart=on-failure

templates/nomad_sysvinit.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ start() {
4141
[ -f "$PID_FILE" ] && rm "$PID_FILE"
4242
daemon --user="{{ nomad_user }}" \
4343
--pidfile="$PID_FILE" \
44-
"$nomad" agent -server -pid-file "${PID_FILE}" -config "${CONFIG_PATH}"/base.hcl -config "${CONFIG_PATH}/{{ nomad_node_role }}.hcl" "${LOG_FILE}" &
44+
"$nomad" agent -"{{ nomad_node_role }}" -config "${CONFIG_PATH}"/base.hcl -config "${CONFIG_PATH}/{{ nomad_node_role }}.hcl" "${LOG_FILE}" &
4545
retcode=$?
4646
touch "{{ nomad_lockfile }}"
4747
return $retcode

templates/server.hcl.j2

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# Enable the server
77
server {
88
enabled = true
9+
bootstrap_expect = {{ nomad_server_count }}
910
{% if nomad_use_consul == False %}
1011
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 %}
1112
{% endfor %}{{ rbracket }}

0 commit comments

Comments
 (0)