From d5060f84f4dc2d73cc782342cb02b10fc71084ee Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 8 May 2021 16:43:07 +0900 Subject: [PATCH 1/4] Install `nomad` even if the node is not `nomad` server/client. --- cookbooks/nomad/default.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cookbooks/nomad/default.rb b/cookbooks/nomad/default.rb index 6a73243..64ce176 100644 --- a/cookbooks/nomad/default.rb +++ b/cookbooks/nomad/default.rb @@ -2,6 +2,8 @@ include_recipe './attributes.rb' include_recipe './install.rb' -include_recipe './setup.rb' +if node['nomad']['manager'] || node['nomad']['client'] + include_recipe './setup.rb' -include_recipe './shared_dir.rb' + include_recipe './shared_dir.rb' +end From bd4f65dcf50f67fc21dbc78ec9cd794234125b46 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 8 May 2021 16:43:23 +0900 Subject: [PATCH 2/4] Change the default config to install `nomad` only. --- cookbooks/nomad/attributes.rb | 2 +- roles/base.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cookbooks/nomad/attributes.rb b/cookbooks/nomad/attributes.rb index 6e0a6ea..367b2d7 100644 --- a/cookbooks/nomad/attributes.rb +++ b/cookbooks/nomad/attributes.rb @@ -4,6 +4,6 @@ node.reverse_merge!({ 'nomad' => { 'manager' => false, - 'client' => true + 'client' => false } }) diff --git a/roles/base.rb b/roles/base.rb index acd267d..fe08b14 100644 --- a/roles/base.rb +++ b/roles/base.rb @@ -7,3 +7,4 @@ include_recipe '../cookbooks/fzf/default.rb' include_recipe '../cookbooks/promtail/default.rb' include_recipe '../cookbooks/vector/default.rb' include_recipe '../cookbooks/prometheus-exporters/default.rb' +include_recipe '../cookbooks/nomad/default.rb' From 531dde8bffd984cc09e87278df8b7cacb348f656 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 19 Jun 2021 19:53:38 +0900 Subject: [PATCH 3/4] Deploy `/etc/nomad.d/server.hcl`. --- cookbooks/nomad/files/etc/nomad.d/server.hcl | 2 +- cookbooks/nomad/setup.rb | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cookbooks/nomad/files/etc/nomad.d/server.hcl b/cookbooks/nomad/files/etc/nomad.d/server.hcl index 385e208..6b8cf5e 100644 --- a/cookbooks/nomad/files/etc/nomad.d/server.hcl +++ b/cookbooks/nomad/files/etc/nomad.d/server.hcl @@ -1,4 +1,4 @@ server { enabled = true - bootstrap_expect = 3 + bootstrap_expect = 1 } diff --git a/cookbooks/nomad/setup.rb b/cookbooks/nomad/setup.rb index f03b6ec..34b42b1 100644 --- a/cookbooks/nomad/setup.rb +++ b/cookbooks/nomad/setup.rb @@ -19,12 +19,14 @@ remote_file '/etc/nomad.d/datadir.hcl' do end if node['nomad']['manager'] - remote_file '/etc/nomad.d/server.hcl' do - owner 'nomad' - group 'nomad' - mode '664' + %w( server.hcl acl.hcl ).each do |conf| + remote_file "/etc/nomad.d/#{conf}" do + owner 'nomad' + group 'nomad' + mode '664' - notifies :restart, 'service[nomad]' + notifies :restart, 'service[nomad]' + end end end From cb368a1445cf57c53378f8482655c1b9a3ba0058 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 19 Jun 2021 19:54:13 +0900 Subject: [PATCH 4/4] Deploy `/etc/nomad.d/acl.hcl`. --- cookbooks/nomad/files/etc/nomad.d/acl.hcl | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 cookbooks/nomad/files/etc/nomad.d/acl.hcl diff --git a/cookbooks/nomad/files/etc/nomad.d/acl.hcl b/cookbooks/nomad/files/etc/nomad.d/acl.hcl new file mode 100644 index 0000000..f88f1d2 --- /dev/null +++ b/cookbooks/nomad/files/etc/nomad.d/acl.hcl @@ -0,0 +1,3 @@ +acl { + enabled = true +}