forked from aws/aws-parallelcluster-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move the cluster user out of /home when the default_user_home option …
…is set to local Refactored the cookbook to use an attribute for the default user's home directory so that it can be changed when using the new config option. Also simplified the users attribute file since the exta OS specific files were not adding any value and duplicating code.
- Loading branch information
1 parent
06edb61
commit 4f62f90
Showing
10 changed files
with
72 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
cookbooks/aws-parallelcluster-environment/recipes/init/move_default_user.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# frozen_string_literal: true | ||
|
||
# | ||
# Copyright:: 2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the | ||
# License. A copy of the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES | ||
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# Backup the cluster user's default home directory | ||
bash "Backup #{node['cluster']['cluster_user_home']}" do | ||
user 'root' | ||
group 'root' | ||
code <<-EOH | ||
mkdir -p /tmp#{node['cluster']['cluster_user_home']} | ||
rsync -a #{node['cluster']['cluster_user_home']} /tmp#{node['cluster']['cluster_user_home']} | ||
EOH | ||
end | ||
|
||
# Move the cluster user's default home directory | ||
bash "Move #{node['cluster']['cluster_user_home']}" do | ||
user 'root' | ||
group 'root' | ||
code <<-EOH | ||
mkdir -p #{node['cluster']['cluster_user_local_home']} | ||
rsync -a /tmp#{node['cluster']['cluster_user_home']}/ #{node['cluster']['cluster_user_local_home']} | ||
usermod -d #{node['cluster']['cluster_user_local_home']} #{node['cluster']['cluster_user']} | ||
rm -rf /tmp#{node['cluster']['cluster_user_home']} | ||
EOH | ||
end | ||
|
||
Chef::Log.info("user home before #{node['cluster']['cluster_user_home']}") | ||
node.normal['cluster']['cluster_user_home'] = node['cluster']['cluster_user_local_home'] | ||
Chef::Log.info("user home after #{node['cluster']['cluster_user_home']}") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
cookbooks/aws-parallelcluster-shared/attributes/users_amazon2.rb
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
cookbooks/aws-parallelcluster-shared/attributes/users_centos7.rb
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
cookbooks/aws-parallelcluster-shared/attributes/users_redhat8.rb
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
cookbooks/aws-parallelcluster-shared/attributes/users_rocky8.rb
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
cookbooks/aws-parallelcluster-shared/attributes/users_ubuntu.rb
This file was deleted.
Oops, something went wrong.