2019-03-03 08:50:49 +00:00
|
|
|
[
|
|
|
|
# only install amd64 package
|
|
|
|
# http://d.hatena.ne.jp/ritchey/20121229
|
|
|
|
'dpkg --remove-architecture i386',
|
|
|
|
|
|
|
|
# Execute `apt update`
|
|
|
|
'apt update',
|
|
|
|
].each do |cmd|
|
|
|
|
execute cmd do
|
|
|
|
user 'root'
|
|
|
|
|
|
|
|
only_if 'dpkg --print-architecture | grep i386'
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# Create /etc/sudoers.d/
|
|
|
|
directory '/etc/sudoers.d/' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '750'
|
|
|
|
end
|
|
|
|
|
|
|
|
# motd configurations:
|
|
|
|
remote_file '/etc/motd.tail' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '644'
|
|
|
|
end
|
|
|
|
|
|
|
|
remote_file '/etc/update-motd.d/99-motd-update' do
|
|
|
|
owner 'root'
|
|
|
|
group 'root'
|
|
|
|
mode '755'
|
|
|
|
end
|
|
|
|
|
|
|
|
# Install the necessary packages:
|
|
|
|
include_recipe './packages.rb'
|
2024-05-11 05:28:07 +00:00
|
|
|
include_recipe './eget.rb'
|
2019-03-03 08:50:49 +00:00
|
|
|
|
|
|
|
# Lang Setting:
|
|
|
|
include_recipe './lang.rb'
|
|
|
|
|
2020-10-10 16:58:15 +00:00
|
|
|
# `unattended-upgrade` settings:
|
|
|
|
include_recipe './unattended-upgrade.rb'
|
2019-03-03 08:50:49 +00:00
|
|
|
|
|
|
|
# `ufw` configurations:
|
|
|
|
include_recipe './ufw.rb'
|
|
|
|
|
|
|
|
# `sshd` configurations:
|
|
|
|
include_recipe './ssh.rb'
|
|
|
|
|
|
|
|
# `fortune` configurations:
|
|
|
|
include_recipe './fortune.rb'
|
|
|
|
|
|
|
|
# timezone configurations:
|
|
|
|
include_recipe './timezone.rb'
|
|
|
|
|
|
|
|
# kernel configurations:
|
|
|
|
include_recipe './kernel.rb'
|
|
|
|
|
|
|
|
# Install mc command:
|
|
|
|
include_recipe './mc.rb'
|
|
|
|
|
2020-11-01 07:25:28 +00:00
|
|
|
# Install lsyncd command:
|
|
|
|
include_recipe './lsyncd.rb'
|
|
|
|
|
2022-08-07 09:18:36 +00:00
|
|
|
# Install starship command:
|
|
|
|
include_recipe './starship.rb'
|
|
|
|
|
2023-12-16 07:18:59 +00:00
|
|
|
# Install cloudflared command:
|
|
|
|
include_recipe './cloudflared.rb'
|
|
|
|
|
2022-08-28 02:58:13 +00:00
|
|
|
# recipes for Ubuntu 20.04 and later
|
|
|
|
case node['platform_version']
|
2024-04-28 02:51:05 +00:00
|
|
|
when "20.04", "22.04", "24.04"
|
2020-11-07 04:01:28 +00:00
|
|
|
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
|
2022-08-28 12:37:30 +00:00
|
|
|
|
|
|
|
package 'systemd-timesyncd'
|
|
|
|
|
|
|
|
service 'systemd-timesyncd' do
|
|
|
|
action :enable
|
|
|
|
end
|
|
|
|
|
2024-04-28 02:51:05 +00:00
|
|
|
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
|
2022-08-28 12:37:30 +00:00
|
|
|
end
|
2020-11-07 04:01:28 +00:00
|
|
|
end
|
|
|
|
|
2024-04-28 02:51:05 +00:00
|
|
|
|
2019-03-03 08:50:49 +00:00
|
|
|
# AWS EC2 Swap Setting:
|
|
|
|
if node['is_ec2']
|
|
|
|
include_recipe './aws_ec2.rb'
|
|
|
|
end
|