Deploy `/etc/consul.d/server.hcl` only when the consul is server.

This commit is contained in:
Kazuhiro MUSASHI 2024-03-31 09:45:29 +09:00
parent b4189939f8
commit 63935ec789
1 changed files with 8 additions and 6 deletions

View File

@ -71,14 +71,16 @@ template '/etc/consul.d/consul.hcl' do
end end
# Deploy server specific config # Deploy server specific config
template '/etc/consul.d/server.hcl' do if node['consul']['manager']
owner 'consul' template '/etc/consul.d/server.hcl' do
group 'consul' owner 'consul'
mode '644' group 'consul'
mode '644'
variables(server_token: node['consul']['server_token']) variables(server_token: node['consul']['server_token'])
notifies :restart, 'service[consul]' notifies :restart, 'service[consul]'
end
end end
%w( 01-bootstrap.sh 02-policy.sh ).each do |sh| %w( 01-bootstrap.sh 02-policy.sh ).each do |sh|