Last active
August 29, 2015 14:13
-
-
Save phrawzty/97470ae758bddd9d4796 to your computer and use it in GitHub Desktop.
packer json and bootstrap script
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
#!/usr/bin/env bash | |
function techo { | |
STAMP=`date '+%b %d %H:%M:%S'` | |
echo "${STAMP} BOOTSTRAP: ${@}" | |
} | |
techo "start" | |
techo "install puppet yum repo" | |
rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm | |
techo "yum check-update" | |
yum check-update | |
techo "yum upgrade" | |
yum -y upgrade | |
techo "yum install puppet" | |
yum -y install puppet | |
techo "end" |
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
# Set up basic Socorro requirements. | |
class socorro::generic { | |
service { | |
'httpd': | |
ensure => stopped, | |
enable => false, | |
require => Package['httpd']; | |
'memcached': | |
ensure => stopped, | |
enable => false, | |
require => Package['memcached']; | |
'postgresql-9.3': | |
ensure => stopped, | |
enable => false, | |
require => [ | |
Package['postgresql93-server'], | |
Exec['postgres-initdb'], | |
File['pg_hba.conf'], | |
]; | |
'elasticsearch': | |
ensure => stopped, | |
enable => false, | |
require => Package['elasticsearch']; | |
} | |
yumrepo { | |
'elasticsearch': | |
baseurl => 'http://packages.elasticsearch.org/elasticsearch/0.90/centos'; | |
'EPEL': | |
baseurl => 'http://dl.fedoraproject.org/pub/epel/$releasever/$basearch', | |
timeout => 60; | |
'PGDG': | |
baseurl => 'http://yum.postgresql.org/9.3/redhat/rhel-$releasever-$basearch'; | |
} | |
Yumrepo['elasticsearch', 'EPEL', 'PGDG'] { | |
enabled => 1, | |
gpgcheck => 0, | |
require => Package['yum-plugin-fastestmirror'] | |
} | |
package { | |
[ | |
'daemonize', | |
'httpd', | |
'java-1.7.0-openjdk', | |
'memcached', | |
'mod_wsgi', | |
'unzip', | |
'yum-plugin-fastestmirror', | |
]: | |
ensure => latest | |
} | |
package { | |
[ | |
'postgresql93-contrib', | |
'postgresql93-devel', | |
'postgresql93-plperl', | |
'postgresql93-server', | |
]: | |
ensure => latest, | |
require => Yumrepo['PGDG'] | |
} | |
package { | |
'supervisor': | |
ensure => latest, | |
require => Yumrepo['EPEL'] | |
} | |
package { | |
'elasticsearch': | |
ensure => latest, | |
require => [ Yumrepo['elasticsearch'], Package['java-1.7.0-openjdk'] ] | |
} | |
file { | |
'/etc/socorro': | |
ensure => directory; | |
'pg_hba.conf': | |
ensure => file, | |
path => '/var/lib/pgsql/9.3/data/pg_hba.conf', | |
source => 'puppet:///modules/socorro/var_lib_pgsql_9.3_data/pg_hba.conf', | |
owner => 'postgres', | |
group => 'postgres', | |
require => [ | |
Package['postgresql93-server'], | |
Exec['postgres-initdb'], | |
], | |
notify => Service['postgresql-9.3']; | |
'pgsql.sh': | |
ensure => file, | |
path => '/etc/profile.d/pgsql.sh', | |
source => 'puppet:///modules/socorro/etc_profile.d/pgsql.sh', | |
owner => 'root'; | |
'elasticsearch.yml': | |
ensure => file, | |
path => '/etc/elasticsearch/elasticsearch.yml', | |
source => 'puppet:///modules/socorro/etc_elasticsearch/elasticsearch.yml', | |
owner => 'root', | |
require => Package['elasticsearch'], | |
notify => Service['elasticsearch']; | |
} | |
} |
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
{ | |
"variables": { | |
"aws_access_key": "", | |
"aws_secret_key": "" | |
}, | |
"builders": [ | |
{ | |
"type": "amazon-ebs", | |
"access_key": "{{user `aws_access_key`}}", | |
"secret_key": "{{user `aws_secret_key`}}", | |
"region": "eu-west-1", | |
"source_ami": "ami-4ac6653d", | |
"instance_type": "t1.micro", | |
"ssh_username": "root", | |
"ami_name": "centos_test {{timestamp}}" | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "shell", | |
"script": "bootstrap.sh" | |
}, | |
{ | |
"type": "puppet-masterless", | |
"manifest_file": "puppet/manifests/default.pp", | |
"module_paths": [ | |
"puppet/modules" | |
], | |
"prevent_sudo": "true" | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment