Skip to content

Commit

Permalink
Add sudo provisioner before chef-solo
Browse files Browse the repository at this point in the history
To disable `sudo` password prompt from building user
  • Loading branch information
Rhythm Chopra committed Sep 1, 2019
1 parent 6b0bac0 commit 88fa429
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packer/templates/ubuntu_1404.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@
"ssh_username": "vagrant",
"ssh_password": "vagrant",
"ssh_wait_timeout": "2h",
"shutdown_command": "echo 'packer' | sudo -S shutdown -P now",
"ssh_pty": true,
"shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
"shutdown_timeout": "10m",
"guest_os_type": "Ubuntu_64",
"disk_size": 40000,
"vm_name": "metasploitable3-ub1404",
Expand Down Expand Up @@ -121,6 +123,12 @@
}
],
"provisioners": [
{
"type": "shell",
"inline": [
"echo 'Disabling sudo password for the user...'",
"echo 'vagrant' | sudo -S bash -c 'echo \"vagrant ALL=(ALL) NOPASSWD:ALL\" >> /etc/sudoers'"]
},
{
"type": "chef-solo",
"version": "13.8.5",
Expand Down

0 comments on commit 88fa429

Please sign in to comment.