itamae/cookbooks/digdag/setup.rb

81 lines
1.4 KiB
Ruby
Raw Normal View History

2019-03-03 08:50:49 +00:00
# Create directory for digdag:
directory '/etc/digdag' do
owner 'root'
group 'root'
mode '755'
end
# Deploy the files:
remote_file "/etc/digdag/digdag.sh" do
owner 'root'
group 'root'
mode '755'
end
remote_file "/etc/digdag/digdag.config" do
owner 'root'
group 'root'
mode '644'
end
# Firewall settings here:
%w( 65432/tcp ).each do |p|
execute "ufw allow #{p}" do
user 'root'
not_if "LANG=c ufw status | grep #{p}"
notifies :run, 'execute[ufw reload-or-enable]'
end
end
execute 'ufw reload-or-enable' do
user 'root'
command 'LANG=C ufw reload | grep skipping && ufw --force enable || exit 0'
action :nothing
end
# Deploy the config file for `systemd`:
remote_file '/lib/systemd/system/digdag.service' do
2019-03-03 08:50:49 +00:00
owner 'root'
group 'root'
mode '644'
end
service 'digdag' do
action [ :enable, :restart ]
2019-03-03 08:50:49 +00:00
end
2020-09-07 13:38:14 +00:00
2023-01-15 11:23:15 +00:00
# Deploy `rsyslog` config file for `digdag`:
remote_file '/etc/rsyslog.d/30-digdag.conf' do
2020-09-07 13:38:14 +00:00
owner 'root'
2023-01-15 11:23:15 +00:00
group 'root'
mode '644'
2020-09-07 13:38:14 +00:00
2023-01-15 11:23:15 +00:00
notifies :restart, 'service[rsyslog]', :immediately
end
# Deploy the config file for `vector`:
remote_file '/etc/vector/digdag.toml' do
owner 'root'
group 'root'
mode '644'
end
2020-09-07 13:38:14 +00:00
# Deploy the `systemd` configuration:
2023-01-15 11:23:15 +00:00
remote_file '/lib/systemd/system/vector-digdag.service' do
2020-09-07 13:38:14 +00:00
owner 'root'
group 'root'
mode '644'
end
# Service setting:
2023-01-15 11:23:15 +00:00
service 'vector-digdag' do
2020-09-07 13:38:14 +00:00
action [ :enable, :restart ]
end
2023-01-15 11:23:15 +00:00
service 'rsyslog' do
action [ :nothing ]
end