Last active
September 1, 2016 00:59
-
-
Save stellimatt/af1cdaad32b9f6c7f34290d2e1b43604 to your computer and use it in GitHub Desktop.
example userdata
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
#!/bin/bash | |
apt-get update | |
apt-get install git -y | |
git clone git://github.com/stelligent/blog_refactor_php /opt/greeter | |
if [ ":" == ":$(dpkg -l | grep chefdk)" ]; then | |
pushd /tmp | |
wget --quiet https://packages.chef.io/stable/ubuntu/12.04/chefdk_0.16.28-1_amd64.deb | |
dpkg -i chefdk_0.16.28-1_amd64.deb | |
mkdir /tmp/cookbooks | |
fi | |
pushd /opt/greeter/pipelines/cookbooks/greeter | |
berks vendor /tmp/cookbooks | |
cat > /tmp/chef.json <<CHEFJSON | |
{ | |
"run_list": [ | |
"greeter" | |
], | |
"greeter": { | |
"db_url": "%{DbUrl}", | |
"db_name": "%{DbName}", | |
"username": "%{DbUsername}", | |
"password": "%{DbPassword}", | |
"docroot": "%{DocRoot}", | |
"server_name": "%{ServerName}" | |
} | |
} | |
CHEFJSON | |
cat > /tmp/solo.rb <<SOLO | |
cookbook_path ['/tmp/cookbooks', '/opt/greeter/pipelines/cookbooks'] | |
SOLO | |
chef-solo -c /tmp/solo.rb -j /tmp/chef.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment