modify-nomad-configs #19

Merged
kazu634 merged 3 commits from modify-nomad-configs into main 2024-04-06 08:10:15 +00:00
4 changed files with 38 additions and 4 deletions

View File

@ -5,6 +5,7 @@ node.reverse_merge!({
'nomad' => { 'nomad' => {
'manager' => false, 'manager' => false,
'client' => false, 'client' => false,
'consul_token' => "f1d577dc-9216-d72a-cc09-1962b1009273",
'lokiendpoint' => 'loki.service.consul:3100', 'lokiendpoint' => 'loki.service.consul:3100',
'synology' => '192.168.10.200' 'synology' => '192.168.10.200'
} }

View File

@ -0,0 +1,23 @@
plugin "docker" {
config {
# extra Docker labels to be set by Nomad on each Docker container with the appropriate value
extra_labels = ["job_name", "task_group_name", "task_name", "namespace", "node_name"]
volumes {
enabled = true
}
allow_privileged = true
}
}
client {
host_volume "docker-sock" {
path = "/var/run/docker.sock"
}
host_volume "tmp" {
path = "/tmp"
}
}

View File

@ -38,15 +38,25 @@ end
if node['nomad']['client'] if node['nomad']['client']
%w( /etc/nomad.d/client.hcl ).each do |conf| %w( /etc/nomad.d/client.hcl ).each do |conf|
remote_file conf do template conf do
owner 'nomad' owner 'nomad'
group 'nomad' group 'nomad'
mode '664' mode '664'
variables(consul_token: node['nomad']['consul_token'])
notifies :restart, 'service[nomad]' notifies :restart, 'service[nomad]'
end end
end end
remote_file "/etc/nomad.d/options.hcl" do
mode "0644"
owner "nomad"
group "nomad"
notifies :restart, 'service[nomad]'
end
directory '/etc/nomad.d/jobs' do directory '/etc/nomad.d/jobs' do
owner 'nomad' owner 'nomad'
group 'nomad' group 'nomad'

View File

@ -6,6 +6,6 @@ client {
} }
} }
# consul { consul {
# token = "11800359-1330-fe54-d858-44e8de9a14f6" token = "<%= @consul_token %>"
# } }