-
-
Save fr34k8/72b5030d2ecc8e3b352ef264e7ecb6b7 to your computer and use it in GitHub Desktop.
initialize as root, setup as normal user
This file contains hidden or 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