Modify base
cookbook.
This commit is contained in:
parent
69b944e455
commit
88bb60ea9a
@ -9,7 +9,7 @@ end
|
|||||||
|
|
||||||
node.reverse_merge!({
|
node.reverse_merge!({
|
||||||
'base' => {
|
'base' => {
|
||||||
'LXC' => lxc
|
'lxc' => lxc
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
include_recipe './attributes.rb'
|
||||||
|
|
||||||
[
|
[
|
||||||
# only install amd64 package
|
# only install amd64 package
|
||||||
# http://d.hatena.ne.jp/ritchey/20121229
|
# http://d.hatena.ne.jp/ritchey/20121229
|
||||||
@ -33,6 +35,17 @@ remote_file '/etc/update-motd.d/99-motd-update' do
|
|||||||
mode '755'
|
mode '755'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# If it is inside an LXC, change the apt repository settings:
|
||||||
|
if node['base']['lxc']
|
||||||
|
%w( /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources ).each do |conf|
|
||||||
|
remote_file conf do
|
||||||
|
mode "0644"
|
||||||
|
owner "root"
|
||||||
|
group "root"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Install the necessary packages:
|
# Install the necessary packages:
|
||||||
include_recipe './packages.rb'
|
include_recipe './packages.rb'
|
||||||
include_recipe './eget.rb'
|
include_recipe './eget.rb'
|
||||||
@ -49,85 +62,52 @@ include_recipe './ufw.rb'
|
|||||||
# `sshd` configurations:
|
# `sshd` configurations:
|
||||||
include_recipe './ssh.rb'
|
include_recipe './ssh.rb'
|
||||||
|
|
||||||
# `fortune` configurations:
|
|
||||||
include_recipe './fortune.rb'
|
|
||||||
|
|
||||||
# timezone configurations:
|
# timezone configurations:
|
||||||
include_recipe './timezone.rb'
|
include_recipe './timezone.rb'
|
||||||
|
include_recipe './ntp.rb'
|
||||||
|
|
||||||
# kernel configurations:
|
# If it is a VM, do the followings.
|
||||||
include_recipe './kernel.rb'
|
# If it is inside an LXC container, do NOTHING.
|
||||||
|
unless node['base']['lxc']
|
||||||
|
# `fortune` configurations:
|
||||||
|
include_recipe './fortune.rb'
|
||||||
|
|
||||||
# Install mc command:
|
# kernel configurations:
|
||||||
include_recipe './mc.rb'
|
include_recipe './kernel.rb'
|
||||||
|
|
||||||
# Install lsyncd command:
|
# Install mc command:
|
||||||
include_recipe './lsyncd.rb'
|
include_recipe './mc.rb'
|
||||||
|
|
||||||
# Install starship command:
|
# Install lsyncd command:
|
||||||
include_recipe './starship.rb'
|
include_recipe './lsyncd.rb'
|
||||||
|
|
||||||
# Install cloudflared command:
|
# Install starship command:
|
||||||
include_recipe './cloudflared.rb'
|
include_recipe './starship.rb'
|
||||||
|
|
||||||
# Disable Ubuntu Pro
|
# Install cloudflared command:
|
||||||
include_recipe './ubuntupro.rb'
|
include_recipe './cloudflared.rb'
|
||||||
|
|
||||||
# recipes for Ubuntu 20.04 and later
|
# Disable Ubuntu Pro
|
||||||
case node['platform_version']
|
include_recipe './ubuntupro.rb'
|
||||||
when "20.04", "22.04", "24.04"
|
|
||||||
remote_file '/etc/multipath.conf' do
|
|
||||||
owner 'root'
|
|
||||||
group 'root'
|
|
||||||
mode '0644'
|
|
||||||
|
|
||||||
notifies :restart, 'service[multipath-tools]'
|
|
||||||
end
|
|
||||||
|
|
||||||
service 'multipath-tools' do
|
|
||||||
action :nothing
|
|
||||||
end
|
|
||||||
|
|
||||||
package 'systemd-timesyncd'
|
|
||||||
|
|
||||||
service 'systemd-timesyncd' do
|
|
||||||
action :enable
|
|
||||||
end
|
|
||||||
|
|
||||||
|
# recipes for Ubuntu 20.04 and later
|
||||||
case node['platform_version']
|
case node['platform_version']
|
||||||
when "20.04"
|
when "20.04", "22.04", "24.04"
|
||||||
remote_file '/etc/systemd/timesyncd.conf' do
|
remote_file '/etc/multipath.conf' do
|
||||||
owner 'root'
|
owner 'root'
|
||||||
group 'root'
|
group 'root'
|
||||||
mode '0644'
|
mode '0644'
|
||||||
|
|
||||||
notifies :restart, 'service[systemd-timesyncd]'
|
notifies :restart, 'service[multipath-tools]'
|
||||||
end
|
end
|
||||||
when "22.04"
|
|
||||||
remote_file '/etc/systemd/timesyncd.conf' do
|
|
||||||
owner 'root'
|
|
||||||
group 'root'
|
|
||||||
mode '0644'
|
|
||||||
|
|
||||||
source 'files/etc/systemd/timesyncd.2204.conf'
|
service 'multipath-tools' do
|
||||||
|
action :nothing
|
||||||
notifies :restart, 'service[systemd-timesyncd]'
|
|
||||||
end
|
|
||||||
when "24.04"
|
|
||||||
remote_file '/etc/systemd/timesyncd.conf' do
|
|
||||||
owner 'root'
|
|
||||||
group 'root'
|
|
||||||
mode '0644'
|
|
||||||
|
|
||||||
source 'files/etc/systemd/timesyncd.2404.conf'
|
|
||||||
|
|
||||||
notifies :restart, 'service[systemd-timesyncd]'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
|
# AWS EC2 Swap Setting:
|
||||||
# AWS EC2 Swap Setting:
|
if node['is_ec2']
|
||||||
if node['is_ec2']
|
include_recipe './aws_ec2.rb'
|
||||||
include_recipe './aws_ec2.rb'
|
end
|
||||||
end
|
end
|
||||||
|
6
cookbooks/base/files/etc/apt/sources.list
Normal file
6
cookbooks/base/files/etc/apt/sources.list
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# deb http://archive.ubuntu.com/ubuntu noble main restricted universe multiverse
|
||||||
|
|
||||||
|
# deb http://archive.ubuntu.com/ubuntu noble-updates main restricted universe multiverse
|
||||||
|
|
||||||
|
# deb http://archive.ubuntu.com/ubuntu noble-security main restricted universe multiverse
|
||||||
|
|
11
cookbooks/base/files/etc/apt/sources.list.d/ubuntu.sources
Normal file
11
cookbooks/base/files/etc/apt/sources.list.d/ubuntu.sources
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Types: deb
|
||||||
|
URIs: http://192.168.10.200:8080/ubuntu/apt-mirror/mirror/jp.archive.ubuntu.com/ubuntu/
|
||||||
|
Suites: noble noble-updates noble-backports
|
||||||
|
Components: main restricted universe multiverse
|
||||||
|
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||||
|
|
||||||
|
Types: deb
|
||||||
|
URIs: http://security.ubuntu.com/ubuntu/
|
||||||
|
Suites: noble-security
|
||||||
|
Components: main restricted universe multiverse
|
||||||
|
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
39
cookbooks/base/ntp.rb
Normal file
39
cookbooks/base/ntp.rb
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
package 'systemd-timesyncd'
|
||||||
|
|
||||||
|
service 'systemd-timesyncd' do
|
||||||
|
action :enable
|
||||||
|
end
|
||||||
|
|
||||||
|
case node['platform_version']
|
||||||
|
when "20.04", "22.04", "24.04"
|
||||||
|
case node['platform_version']
|
||||||
|
when "20.04"
|
||||||
|
remote_file '/etc/systemd/timesyncd.conf' do
|
||||||
|
owner 'root'
|
||||||
|
group 'root'
|
||||||
|
mode '0644'
|
||||||
|
|
||||||
|
notifies :restart, 'service[systemd-timesyncd]'
|
||||||
|
end
|
||||||
|
when "22.04"
|
||||||
|
remote_file '/etc/systemd/timesyncd.conf' do
|
||||||
|
owner 'root'
|
||||||
|
group 'root'
|
||||||
|
mode '0644'
|
||||||
|
|
||||||
|
source 'files/etc/systemd/timesyncd.2204.conf'
|
||||||
|
|
||||||
|
notifies :restart, 'service[systemd-timesyncd]'
|
||||||
|
end
|
||||||
|
when "24.04"
|
||||||
|
remote_file '/etc/systemd/timesyncd.conf' do
|
||||||
|
owner 'root'
|
||||||
|
group 'root'
|
||||||
|
mode '0644'
|
||||||
|
|
||||||
|
source 'files/etc/systemd/timesyncd.2404.conf'
|
||||||
|
|
||||||
|
notifies :restart, 'service[systemd-timesyncd]'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -2,7 +2,7 @@
|
|||||||
execute 'apt update'
|
execute 'apt update'
|
||||||
|
|
||||||
# Install the necessary packages:
|
# Install the necessary packages:
|
||||||
%w[build-essential zsh vim-nox debian-keyring curl direnv jq avahi-daemon wget gpg coreutils].each do |pkg|
|
%w[build-essential zsh vim-nox debian-keyring curl direnv jq avahi-daemon wget gpg coreutils software-properties-common].each do |pkg|
|
||||||
package pkg
|
package pkg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user