Created
January 18, 2013 20:18
-
-
Save Ancillas/4568142 to your computer and use it in GitHub Desktop.
A very simple Puppet example of setting the authorized_keys, id_rsa, and sudoers file for passwordless sudo access.
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
node default { | |
class {'passwordlessroot': | |
publickey => "public", | |
privatekey => "private", | |
} | |
} | |
class passwordlessroot( | |
$publickey, | |
$privatekey | |
){ | |
file { 'privatekey': | |
path => '/root/.ssh/id_rsa', | |
ensure => 'present', | |
mode => '0400', | |
owner => 'root', | |
group => 'root', | |
content => "$privatekey", | |
} | |
file { 'publickey': | |
path => '/root/.ssh/authorized_keys', | |
ensure => 'present', | |
mode => '0600', | |
owner => 'root', | |
group => 'root', | |
content => "$publickey", | |
} | |
file { 'sudoers': | |
path => '/etc/sudoers', | |
ensure => 'present', | |
mode => '0600', | |
owner => 'root', | |
group => 'root', | |
content => 'puppet:///path/to/your/sudoers/file', | |
} | |
# Your sudoers template really only needs one line added, or replaced (if an entry for root already exists) | |
# root ALL=(ALL) NOPASSWD: ALL | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment