itamae/cookbooks/consul/setup.rb

30 lines
648 B
Ruby
Raw Normal View History

2019-03-03 08:50:49 +00:00
template '/etc/consul.d/config.json' do
2020-11-22 07:00:00 +00:00
owner 'consul'
group 'consul'
2019-03-03 08:50:49 +00:00
mode '644'
variables(manager: node['consul']['manager'],
manager_hosts: node['consul']['manager_hosts'],
ipaddr: node['consul']['ipaddr'],
)
notifies :restart, 'service[supervisor]'
2019-03-03 08:50:49 +00:00
end
remote_file '/etc/consul.d/service-consul.json' do
2020-11-22 07:00:00 +00:00
owner 'consul'
group 'consul'
2019-03-03 08:50:49 +00:00
mode '644'
end
# iptables settings here:
%w( 8300/tcp 8301/tcp 8301/udp 8500/tcp ).each do |port|
execute "ufw allow #{port}" do
user 'root'
not_if "LANG=c ufw status | grep #{port}"
notifies :run, 'execute[ufw reload-or-enable]'
end
end