itamae/cookbooks/docker/setup.rb

74 lines
1.4 KiB
Ruby
Raw Permalink Normal View History

2021-04-25 10:37:45 +00:00
# Ignore the certificate
2023-02-05 06:02:03 +00:00
directory '/etc/docker/' do
owner 'root'
group 'root'
mode '0600'
end
2021-04-25 10:37:45 +00:00
remote_file '/etc/docker/daemon.json' do
owner 'root'
group 'root'
mode '0600'
notifies :restart, 'service[docker]'
end
2019-03-03 08:50:49 +00:00
# install `cifs-utils`
package 'cifs-utils'
2021-04-25 10:37:45 +00:00
%w( /mnt/shared /var/spool/apt-mirror ).each do |d|
directory d do
owner 'root'
group 'root'
end
2019-03-03 08:50:49 +00:00
end
# Add the fstab entry:
file '/etc/fstab' do
action :edit
block do |content|
2021-04-25 10:37:45 +00:00
content << "//192.168.10.200/Shared/AppData /mnt/shared cifs username=admin,password=Holiday88,uid=root,gid=root,file_mode=0777,dir_mode=0777,vers=3.0,_netdev 0 0\n"
2019-03-03 08:50:49 +00:00
end
2021-04-25 10:37:45 +00:00
not_if 'grep shared /etc/fstab'
2019-03-03 08:50:49 +00:00
end
2021-04-25 10:37:45 +00:00
execute 'mount -a || true'
2019-03-03 08:50:49 +00:00
# Deploy the cron.d file:
remote_file '/etc/cron.d/docker-housekeep' do
owner 'root'
group 'root'
mode '644'
end
# Deploy config file for `vector`:
template '/etc/vector/docker.toml' do
owner 'root'
group 'root'
mode '644'
variables(LOKI: node['docker']['loki'],
HOSTNAME: node[:hostname]
)
source 'templates/etc/vector/docker.toml.erb'
notifies :restart, 'service[vector-docker]'
end
# Deploy `systemd` configuration for `prometheus`:
remote_file '/etc/systemd/system/vector-docker.service' do
owner 'root'
group 'root'
mode '644'
notifies :restart, 'service[vector-docker]'
end
# Service setting:
service 'vector-docker' do
action [ :enable, :restart ]
end