Skip to content

Instantly share code, notes, and snippets.

@arowla
Last active August 29, 2015 13:57
Show Gist options
  • Save arowla/9404669 to your computer and use it in GitHub Desktop.
Save arowla/9404669 to your computer and use it in GitHub Desktop.
Setting up Puppet on EC2. http://davidwinter.me/articles/2012/12/08/setting-up-puppet-master-and-agents-on-ec2/ was very helpful, but I had to make a few modifications to the files to get them to work.
#!/bin/bash
# This is the user-data script for EC2. It still didn't work as a user-data script,
# but once uploaded to the new server and then executed, it worked.
set -e -x
EC2_HOSTNAME=<put master hostname here>
export DEBIAN_FRONTEND=noninteractive
hostname $EC2_HOSTNAME
echo $EC2_HOSTNAME > /etc/hostname
wget https://apt.puppetlabs.com/puppetlabs-release-precise.deb
dpkg -i puppetlabs-release-precise.deb
aptitude -y update
aptitude -y install puppetmaster
echo "*" > /etc/puppet/autosign.conf
service puppetmaster restart
package { 'nginx':
ensure => present,
}
service { 'nginx':
ensure => running,
require => Package['nginx'],
}
file { '/usr/share/nginx/html/index.html':
content => '<h1>Hello from Puppet master!</h1>',
require => Package['nginx'],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment