Created
May 29, 2015 12:07
-
-
Save ferki/77695bbfe7c00a713300 to your computer and use it in GitHub Desktop.
initialize as root, setup as normal user
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
use Rex -base; | |
user 'deployer'; | |
password 'userpass'; | |
sudo_password 'userpass'; | |
sudo TRUE; | |
auth for => initialize => | |
user => 'root', | |
password => 'rootpass'; | |
task 'initialize', sub { | |
#create user | |
account 'deployer', | |
ensure => 'present', | |
groups => [qw(wheel)], | |
password => 'userpass', | |
#crypt_password => '*', | |
#create_home => TRUE, | |
#ssh_key => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQChUw..."; | |
; | |
#setup sudo | |
pkg 'sudo', ensure => 'present'; | |
append_or_amend_line '/etc/sudoers', | |
line => '%wheel ALL=(ALL) ALL'; | |
#configure SSH | |
append_or_amend_line '/etc/ssh/sshd_config', | |
line => 'PermitRootLogin no', | |
regexp => qr{\#?PermitRootLogin (yes|no)}, | |
on_change => sub { service 'sshd' => 'reload' }; | |
}; | |
task 'setup', sub { | |
pkg 'cowsay', ensure => 'present'; | |
}; | |
batch provision => 'initialize', 'setup'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment