Created
November 8, 2016 12:01
-
-
Save chris-rock/b6b0aea064f1ddce89d332ffe79fcb56 to your computer and use it in GitHub Desktop.
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
# encoding: utf-8 | |
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# make chef-server known by hostname | |
CHEF_AUTOMATE_SCRIPT = <<EOF.freeze | |
# update system | |
apt-get update | |
apt-get -y install curl | |
# ensure the time is uptodate | |
apt-get -y install ntp | |
service ntp stop | |
ntpdate -s time.nist.gov | |
service ntp start | |
echo "Install Chef Automate Server" | |
sudo apt-get install apt-transport-https | |
wget -qO - https://packages.chef.io/chef.asc | sudo apt-key add - | |
sudo echo "deb https://packages.chef.io/repos/apt/current trusty main" > /etc/apt/sources.list.d/chef-current.list | |
sudo apt-get update | |
sudo apt-get install delivery | |
sudo rm -f /etc/delivery/delivery.rb | |
export AUTOMATE_LICENSE=/vagrant/delivery.license | |
export AUTOMATE_CHEF_USER_KEY=/vagrant/adminkey.pem | |
export CHEF_SERVER_FQDN=chef.compliance.test | |
export AUTOMATE_CHEF_ORG=brewinc | |
export AUTOMATE_SERVER_FQDN=automate.compliance.test | |
export DELIVER_ENTERPRISE_NAME=brewinc | |
sudo delivery-ctl setup --license $AUTOMATE_LICENSE \ | |
--key $AUTOMATE_CHEF_USER_KEY \ | |
--server-url https://$CHEF_SERVER_FQDN/organizations/$AUTOMATE_CHEF_ORG \ | |
--fqdn $AUTOMATE_SERVER_FQDN \ | |
-e $DELIVER_ENTERPRISE_NAME \ | |
--configure | |
EOF | |
def set_hostname(server) | |
server.vm.provision 'shell', inline: "hostname #{server.vm.hostname}" | |
end | |
Vagrant.configure(2) do |config| | |
config.vm.define 'chef-automate' do |server| | |
server.vm.box = 'bento/ubuntu-14.04' | |
server.vm.box_url = 'http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box' | |
server.vm.hostname = 'automate.compliance.test' | |
server.vm.network 'private_network', ip: '192.168.33.151' | |
server.vm.synced_folder './vagrant/', '/vagrant' | |
server.vm.provision 'shell', inline: CHEF_AUTOMATE_SCRIPT.dup | |
set_hostname(server) | |
server.vm.provider 'virtualbox' do |v| | |
v.memory = 2048 | |
v.cpus = 2 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment