Skip to content

Commit

Permalink
Fixes #37919 - make sure sudo is installed
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernhard committed Oct 16, 2024
1 parent 477170a commit 6a28093
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ description: |
file.
-%>

# Select package manager for the OS (sets the $PKG_MANAGER* variables)
if [ -z "$PKG_MANAGER" ]; then
<%= indent(2) { snippet 'pkg_manager' } -%>
fi

<% if !host_param('remote_execution_ssh_keys').blank? %>
<% ssh_user = host_param('remote_execution_ssh_user') || 'root' %>

Expand Down Expand Up @@ -58,6 +63,7 @@ EOF
command -v restorecon && restorecon -RvF <%= ssh_path %> || true

<% if ssh_user != 'root' && host_param('remote_execution_effective_user_method') == 'sudo' -%>
$PKG_MANAGER_INSTALL sudo
<% if @host.operatingsystem.family == 'Redhat' || @host.operatingsystem.family == 'Debian' -%>
echo "<%= ssh_user %> ALL = (root) NOPASSWD : ALL" > /etc/sudoers.d/<%= ssh_user %>
echo "Defaults:<%= ssh_user %> !requiretty" >> /etc/sudoers.d/<%= ssh_user %>
Expand Down

0 comments on commit 6a28093

Please sign in to comment.