Skip to content

Commit 35f20fd

Browse files
committed
Add Chef resource files for Rocky Linux
Used the new utility `os-resources.py` to create new resources for rocky linux, starting from redhat8 resources. Manually modified: * efa -> Replaced RHEL with Rocky Linux in log messages * lustre -> Replaced RHEL with Rocky Linux in log messages * users --> Replaced ec2-user with rocky * os_type --> Replaced rhel with rocky * install_packages --> Removed postgresql packages Removed redhat_on_docker condition from: * stunnel * system_authentication * efa Signed-off-by: Enrico Usai <[email protected]>
1 parent 49dcba2 commit 35f20fd

File tree

31 files changed

+849
-0
lines changed

31 files changed

+849
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
provides :cloudwatch, platform: 'rocky' do |node|
16+
node['platform_version'].to_i == 8
17+
end
18+
19+
use 'partial/_cloudwatch_common'
20+
use 'partial/_cloudwatch_install_package_rhel'
21+
22+
action_class do
23+
def platform_url_component
24+
node['platform']
25+
end
26+
end
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
3+
#
4+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License").
7+
# You may not use this file except in compliance with the License.
8+
# A copy of the License is located at
9+
#
10+
# http://aws.amazon.com/apache2.0/
11+
#
12+
# or in the "LICENSE.txt" file accompanying this file.
13+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
14+
# See the License for the specific language governing permissions and limitations under the License.
15+
provides :ec2_udev_rules, platform: 'rocky' do |node|
16+
node['platform_version'].to_i == 8
17+
end
18+
19+
unified_mode true
20+
use 'partial/_common_udev_configuration'
21+
22+
default_action :setup
23+
24+
action :setup do
25+
action_create_common_udev_files
26+
action_start_ec2blk
27+
end
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
provides :efa, platform: 'rocky' do |node|
16+
node['platform_version'].to_i == 8
17+
end
18+
unified_mode true
19+
default_action :setup
20+
21+
use 'partial/_common'
22+
23+
action_class do
24+
def efa_supported?
25+
if node['platform_version'].to_f < 8.4
26+
log "EFA is not supported in this Rocky Linux version #{node['platform_version']}, supported versions are >= 8.4" do
27+
level :warn
28+
end
29+
false
30+
else
31+
true
32+
end
33+
end
34+
35+
def conflicting_packages
36+
%w(openmpi-devel openmpi)
37+
end
38+
39+
def prerequisites
40+
%w(environment-modules libibverbs-utils librdmacm-utils rdma-core-devel)
41+
end
42+
end
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
provides :efs, platform: 'rocky' do |node|
16+
node['platform_version'].to_i == 8
17+
end
18+
19+
use 'partial/_get_package_version_rpm'
20+
use 'partial/_common'
21+
use 'partial/_redhat_based'
22+
use 'partial/_install_from_tar'
23+
use 'partial/_mount_umount'
24+
25+
def prerequisites
26+
%w(rpm-build make)
27+
end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
provides :ephemeral_drives, platform: 'rocky' do |node|
16+
node['platform_version'].to_i == 8
17+
end
18+
19+
use 'partial/_ephemeral_drives_common.rb'
20+
21+
action_class do
22+
def network_target
23+
'network-online.target'
24+
end
25+
end
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# frozen_string_literal: true
2+
3+
#
4+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License").
7+
# You may not use this file except in compliance with the License.
8+
# A copy of the License is located at
9+
#
10+
# http://aws.amazon.com/apache2.0/
11+
#
12+
# or in the "LICENSE.txt" file accompanying this file.
13+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
14+
# See the License for the specific language governing permissions and limitations under the License.
15+
16+
provides :lustre, platform: 'rocky' do |node|
17+
node['platform_version'].to_i == 8
18+
end
19+
unified_mode true
20+
21+
use 'partial/_install_lustre_centos_redhat'
22+
use 'partial/_mount_unmount'
23+
24+
default_action :setup
25+
26+
action :setup do
27+
version = node['platform_version']
28+
if version.to_f < 8.2
29+
log "FSx for Lustre is not supported in this Rocky Linux version #{version}, supported versions are >= 8.2" do
30+
level :warn
31+
end
32+
# rhel8 kernel 4.18.0-425.3.1.el8 has broken kABI compat https://github.com/openzfs/zfs/issues/14724
33+
elsif node['cluster']['kernel_release'].include? "4.18.0-425.3.1.el8"
34+
log "FSx for Lustre is not supported in kernel version 4.18.0-425.3.1.el8 of Rocky Linux, please update the kernel version" do
35+
level :warn
36+
end
37+
else
38+
action_install_lustre
39+
end
40+
end
41+
42+
def find_os_minor_version
43+
os_minor_version = ''
44+
kernel_patch_version = find_kernel_patch_version
45+
46+
# kernel patch versions under 193 are prior to RHEL 8.2
47+
# kernel patch version number can be retrieved from https://access.redhat.com/articles/3078#RHEL8
48+
os_minor_version = '2' if kernel_patch_version >= '193'
49+
os_minor_version = '3' if kernel_patch_version >= '240'
50+
os_minor_version = '4' if kernel_patch_version >= '305'
51+
os_minor_version = '5' if kernel_patch_version >= '348'
52+
os_minor_version = '6' if kernel_patch_version >= '372'
53+
os_minor_version = '7' if kernel_patch_version >= '425'
54+
os_minor_version = '8' if kernel_patch_version >= '477'
55+
56+
os_minor_version
57+
end
58+
59+
action_class do
60+
def base_url
61+
# https://docs.aws.amazon.com/fsx/latest/LustreGuide/install-lustre-client.html#lustre-client-rhel
62+
"https://fsx-lustre-client-repo.s3.amazonaws.com/el/8.#{find_os_minor_version}/$basearch"
63+
end
64+
65+
def public_key
66+
"https://fsx-lustre-client-repo-public-keys.s3.amazonaws.com/fsx-rpm-public-key.asc"
67+
end
68+
end
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
provides :network_service, platform: 'rocky' do |node|
16+
node['platform_version'].to_i == 8
17+
end
18+
19+
use 'partial/_network_service'
20+
use 'partial/_network_service_redhat_based'
21+
22+
def network_service_name
23+
'NetworkManager'
24+
end
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# frozen_string_literal: true
2+
3+
#
4+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License").
7+
# You may not use this file except in compliance with the License.
8+
# A copy of the License is located at
9+
#
10+
# http://aws.amazon.com/apache2.0/
11+
#
12+
# or in the "LICENSE.txt" file accompanying this file.
13+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
14+
# See the License for the specific language governing permissions and limitations under the License.
15+
16+
provides :nfs, platform: 'rocky' do |node|
17+
node['platform_version'].to_i == 8
18+
end
19+
unified_mode true
20+
21+
use 'partial/_install_nfs4_and_disable'
22+
use 'partial/_configure'
23+
24+
default_action :setup
25+
26+
action :setup do
27+
action_install_nfs4
28+
action_disable_start_at_boot
29+
end
30+
31+
action_class do
32+
def override_server_template
33+
edit_resource(:template, node['nfs']['config']['server_template']) do
34+
cookbook 'nfs'
35+
end
36+
end
37+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
provides :raid, platform: 'rocky' do |node|
2+
node['platform_version'].to_i == 8
3+
end
4+
5+
use 'partial/_raid_common'
6+
7+
action_class do
8+
def raid_superblock_version
9+
'1.2'
10+
end
11+
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
provides :system_authentication, platform: 'rocky' do |node|
16+
node['platform_version'].to_i == 8
17+
end
18+
19+
use 'partial/_system_authentication_common'
20+
21+
action :configure do
22+
# oddjobd service is required for creating homedir
23+
service "oddjobd" do
24+
action %i(start enable)
25+
end unless on_docker?
26+
27+
execute 'Configure Directory Service' do
28+
user 'root'
29+
# Tell NSS, PAM to use SSSD for system authentication and identity information
30+
# authconfig is a compatibility tool, replaced by authselect
31+
command "authselect select sssd with-mkhomedir"
32+
sensitive true
33+
end
34+
end
35+
36+
action_class do
37+
def required_packages
38+
%w(sssd sssd-tools sssd-ldap authselect oddjob-mkhomedir)
39+
end
40+
end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
provides :arm_pl, platform: 'rocky' do |node|
16+
node['platform_version'].to_i == 8
17+
end
18+
19+
use 'partial/_arm_pl_common.rb'
20+
21+
action_class do
22+
def armpl_platform
23+
'RHEL-8'
24+
end
25+
end
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
provides :build_tools, platform: 'rocky' do |node|
16+
node['platform_version'].to_i == 8
17+
end
18+
19+
use 'partial/_build_tools_yum.rb'
20+
21+
action_class do
22+
def packages
23+
%w(gcc gcc-c++ make)
24+
end
25+
end

0 commit comments

Comments
 (0)