From 70c90a18e2e25cfc5d1a9f5c2412b40433ac88d9 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sun, 25 Apr 2021 19:37:45 +0900 Subject: [PATCH] Ensure to satisfy the prerequisites. --- cookbooks/docker/files/etc/docker/daemon.json | 3 +++ cookbooks/docker/install.rb | 8 +++++- cookbooks/docker/setup.rb | 27 +++++++++---------- 3 files changed, 23 insertions(+), 15 deletions(-) create mode 100644 cookbooks/docker/files/etc/docker/daemon.json diff --git a/cookbooks/docker/files/etc/docker/daemon.json b/cookbooks/docker/files/etc/docker/daemon.json new file mode 100644 index 0000000..59e6247 --- /dev/null +++ b/cookbooks/docker/files/etc/docker/daemon.json @@ -0,0 +1,3 @@ +{ + "insecure-registries" : ["reg.kazu634.com"] +} diff --git a/cookbooks/docker/install.rb b/cookbooks/docker/install.rb index 1425af5..050e460 100644 --- a/cookbooks/docker/install.rb +++ b/cookbooks/docker/install.rb @@ -19,4 +19,10 @@ execute 'apt-get update' do not_if 'which docker' end -package 'docker-ce' +%w(docker-ce docker-ce-cli containerd.io).each do |p| + package p +end + +service 'docker' do + action :nothing +end diff --git a/cookbooks/docker/setup.rb b/cookbooks/docker/setup.rb index 7745fb8..422708a 100644 --- a/cookbooks/docker/setup.rb +++ b/cookbooks/docker/setup.rb @@ -1,7 +1,16 @@ +# Ignore the certificate +remote_file '/etc/docker/daemon.json' do + owner 'root' + group 'root' + mode '0600' + + notifies :restart, 'service[docker]' +end + # install `cifs-utils` package 'cifs-utils' -%w( /mnt/backup /var/spool/apt-mirror ).each do |d| +%w( /mnt/shared /var/spool/apt-mirror ).each do |d| directory d do owner 'root' group 'root' @@ -13,23 +22,13 @@ file '/etc/fstab' do action :edit block do |content| - content << "//192.168.10.200/Shared/AppData /mnt/backup cifs username=admin,password=Holiday88,uid=root,gid=root,file_mode=0777,dir_mode=0777,vers=3.0,_netdev 0 0\n" + 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" end - not_if 'grep backup /etc/fstab' + not_if 'grep shared /etc/fstab' end -file '/etc/fstab' do - action :edit - - block do |content| - content << "//192.168.10.200/Shared/PXEBoot/www/ubuntu/apt-mirror /var/spool/apt-mirror cifs username=admin,password=Holiday88,uid=root,gid=root,file_mode=0777,dir_mode=0777,vers=3.0,_netdev 0 0\n" - end - - not_if 'grep apt-mirror /etc/fstab' -end - -execute 'mount -a' +execute 'mount -a || true' # Deploy the cron.d file: remote_file '/etc/cron.d/docker-housekeep' do