Modify base
cookbook.
This commit is contained in:
parent
69b944e455
commit
88bb60ea9a
@ -9,7 +9,7 @@ end
|
||||
|
||||
node.reverse_merge!({
|
||||
'base' => {
|
||||
'LXC' => lxc
|
||||
'lxc' => lxc
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
include_recipe './attributes.rb'
|
||||
|
||||
[
|
||||
# only install amd64 package
|
||||
# http://d.hatena.ne.jp/ritchey/20121229
|
||||
@ -33,6 +35,17 @@ remote_file '/etc/update-motd.d/99-motd-update' do
|
||||
mode '755'
|
||||
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:
|
||||
include_recipe './packages.rb'
|
||||
include_recipe './eget.rb'
|
||||
@ -49,33 +62,37 @@ include_recipe './ufw.rb'
|
||||
# `sshd` configurations:
|
||||
include_recipe './ssh.rb'
|
||||
|
||||
# `fortune` configurations:
|
||||
include_recipe './fortune.rb'
|
||||
|
||||
# timezone configurations:
|
||||
include_recipe './timezone.rb'
|
||||
include_recipe './ntp.rb'
|
||||
|
||||
# kernel configurations:
|
||||
include_recipe './kernel.rb'
|
||||
# If it is a VM, do the followings.
|
||||
# If it is inside an LXC container, do NOTHING.
|
||||
unless node['base']['lxc']
|
||||
# `fortune` configurations:
|
||||
include_recipe './fortune.rb'
|
||||
|
||||
# Install mc command:
|
||||
include_recipe './mc.rb'
|
||||
# kernel configurations:
|
||||
include_recipe './kernel.rb'
|
||||
|
||||
# Install lsyncd command:
|
||||
include_recipe './lsyncd.rb'
|
||||
# Install mc command:
|
||||
include_recipe './mc.rb'
|
||||
|
||||
# Install starship command:
|
||||
include_recipe './starship.rb'
|
||||
# Install lsyncd command:
|
||||
include_recipe './lsyncd.rb'
|
||||
|
||||
# Install cloudflared command:
|
||||
include_recipe './cloudflared.rb'
|
||||
# Install starship command:
|
||||
include_recipe './starship.rb'
|
||||
|
||||
# Disable Ubuntu Pro
|
||||
include_recipe './ubuntupro.rb'
|
||||
# Install cloudflared command:
|
||||
include_recipe './cloudflared.rb'
|
||||
|
||||
# recipes for Ubuntu 20.04 and later
|
||||
case node['platform_version']
|
||||
when "20.04", "22.04", "24.04"
|
||||
# Disable Ubuntu Pro
|
||||
include_recipe './ubuntupro.rb'
|
||||
|
||||
# recipes for Ubuntu 20.04 and later
|
||||
case node['platform_version']
|
||||
when "20.04", "22.04", "24.04"
|
||||
remote_file '/etc/multipath.conf' do
|
||||
owner 'root'
|
||||
group 'root'
|
||||
@ -87,47 +104,10 @@ when "20.04", "22.04", "24.04"
|
||||
service 'multipath-tools' do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
package 'systemd-timesyncd'
|
||||
|
||||
service 'systemd-timesyncd' do
|
||||
action :enable
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
|
||||
# AWS EC2 Swap Setting:
|
||||
if node['is_ec2']
|
||||
# AWS EC2 Swap Setting:
|
||||
if node['is_ec2']
|
||||
include_recipe './aws_ec2.rb'
|
||||
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'
|
||||
|
||||
# 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
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user