Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtimberman/401336 to your computer and use it in GitHub Desktop.
Save jtimberman/401336 to your computer and use it in GitHub Desktop.
#!/bin/sh
#Provides add-apt-repository
sudo apt-get install -y python-software-properties
#use jtimberman's chef ppa for installation
sudo add-apt-repository ppa:jtimberman/opschef
sudo apt-get update
sudo apt-get upgrade -y
#This step asks for a chef server url to put in /etc/chef/client.rb
sudo apt-get install -y chef
#copy /etc/chef/validation.pem from server to same location on client
#How to script this?
scp user@chefserver.local:/etc/chef/validation.pem /etc/chef/
# Verify chef-client works:
sudo chef-client
@dragon788
Copy link

If you add a -y to the add-apt-repository command somebody can copy and paste the script into the terminal without getting interrupted by the "press Enter to add to system" that shows up for interactive terminals. The reason it works in a script without it is that it detects the terminal isn't interactive and just continues.

@dragon788
Copy link

For the validation.pem you could put it somewhere it is accessible without needing a user credential to the server (symlink/hardlink to /var/www and then present it via nginx with basic auth using an .htaccess maybe and use curl to pull it with the username and password hardcoded. Otherwise you would need to have an SSH key setup for passwordless access to the server for SSH/scp to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment