Skip to content

Commit

Permalink
Merge pull request #11 from terrimonster/test_38
Browse files Browse the repository at this point in the history
Changes for PE 3.8
  • Loading branch information
Terri Haber committed Apr 28, 2015
2 parents 6bde459 + 419f025 commit 7600170
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 92 deletions.
32 changes: 9 additions & 23 deletions provision/bootstrap_r10k.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,18 @@
#!/bin/bash

rm -rf /etc/puppetlabs/puppet/environments/production
HOSTNAME=`hostname`

if [[ $HOSTNAME =~ vagrant ]]; then
MODPATH='/vagrant/site'
else
MODPATH='/etc/puppetlabs/puppet/environments/production/site'
fi

/opt/puppet/bin/puppet module install zack-r10k --modulepath \
/etc/puppetlabs/puppet/modules --ignore-requirements
/opt/puppet/bin/puppet apply -e 'include profile::puppet::r10k' --modulepath=$MODPATH

cat > /tmp/newsite.pp <<EOM
case $::settings::server {
'xmaster.vagrant.vm': {
\$remote = '/vagrant'
}
default: {
\$remote = '[email protected]:terrimonster/puppet-control.git'
}
}
class { 'r10k':
version => '1.4.1',
remote => \$remote,
}
EOM
echo "APPLYING R10K"
/opt/puppet/bin/puppet apply /tmp/newsite.pp \
--modulepath=/etc/puppetlabs/puppet/modules
rm -rf /etc/puppetlabs/puppet/environments/production

/opt/puppet/bin/r10k deploy environment -p production --puppetfile \
--verbose debug
echo "Sleeping for 10 seconds while prod env is recognized"

sleep 10

/opt/puppet/bin/puppet agent -t
1 change: 1 addition & 0 deletions provision/pe/answers/master.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ q_puppetmaster_enterpriseconsole_port=443
q_puppetmaster_install=y
q_run_updtvpkg=n
q_vendor_packages_install=y
q_enable_future_parser=n
63 changes: 34 additions & 29 deletions provision/provision.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

PE_VERSION="3.7.2"
PE_VERSION="3.8.0"

###########################################################
ANSWERS=$1
Expand All @@ -19,40 +19,45 @@ cat > /etc/hosts <<EOH
192.168.137.14 xagent.vagrant.vm xagent
EOH

## Download and extract the PE installer
cd /vagrant/provision/pe || (echo "/vagrant/provision/pe doesn't exist." && exit 1)
if [ ! -f $FILENAME ]; then
curl -O ${PE_URL} || (echo "Failed to download ${PE_URL}" && exit 1)
else
echo "${FILENAME} already present"
fi

if [ ! -d ${DIRNAME} ]; then
tar zxf ${FILENAME} || (echo "Failed to extract ${FILENAME}" && exit 1)
else
echo "${DIRNAME} already present"
fi

## Install PE with a specified answer file
if [ ! -d '/opt/puppet/' ]; then
# Assume puppet isn't installed
/vagrant/provision/pe/${DIRNAME}/puppet-enterprise-installer \
-a /vagrant/provision/pe/answers/${ANSWERS}
else
echo "/opt/puppet exists. Assuming it's already installed."
fi

## turning off iptables

# turn off iptables
/sbin/service iptables stop

## Bootstrap the master
# download and full install only happens on master
if [ "$1" == 'master.txt' ]; then

## deploy keys
## Download and extract the PE installer
cd /vagrant/provision/pe || (echo "/vagrant/provision/pe doesn't exist." && exit 1)
if [ ! -f $FILENAME ]; then
curl -O ${PE_URL} || (echo "Failed to download ${PE_URL}" && exit 1)
else
echo "${FILENAME} already present"
fi

if [ ! -d ${DIRNAME} ]; then
tar zxf ${FILENAME} || (echo "Failed to extract ${FILENAME}" && exit 1)
else
echo "${DIRNAME} already present"
fi

## Install PE with a specified answer file
if [ ! -d '/opt/puppet/' ]; then
# Assume puppet isn't installed
/vagrant/provision/pe/${DIRNAME}/puppet-enterprise-installer \
-a /vagrant/provision/pe/answers/${ANSWERS}
else
echo "/opt/puppet exists. Assuming it's already installed."
fi


## Bootstrap the master

/vagrant/provision/bootstrap_r10k.sh

echo "All done! Now ssh in using vagrant ssh xmaster and sudo to root!"

else

curl -k https://xmaster.vagrant.vm:8140/packages/current/install.bash | bash

echo "Finished! Access this instance using 'vagrant ssh xagent', sudo to root!"

fi
7 changes: 0 additions & 7 deletions site/profile/manifests/base/linux.pp

This file was deleted.

12 changes: 0 additions & 12 deletions site/profile/manifests/gitlab.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,4 @@
refreshonly => true,
}

## Firewall rules for Gitlab
firewall { '100 allow http and https access':
port => [80, 443],
proto => 'tcp',
action => 'accept',
}

firewall { '110 allow ssh':
port => '22',
proto => 'tcp',
action => 'accept',
}
}
22 changes: 4 additions & 18 deletions site/profile/manifests/puppet/master.pp
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
class profile::puppet::master (
$hiera_eyaml = false,
$autosign = false,
$environmentpath = "${::settings::confdir}/environments",
$deploy_pub_key = "",
$deploy_private_key = "",
$r10k_version = '1.4.1',
$environmentpath = $::profile::puppet::params::environmentpath,
) inherits profile::puppet::params {
validate_string($remote)
validate_bool($hiera_eyaml,$autosign)

include profile::puppet::r10k

File {
owner => 'root',
group => 'root',
Expand All @@ -26,21 +27,6 @@
notify => Service['pe-puppetserver'],
}

class { 'r10k':
version => $r10k_version,
sources => {
'control' => {
'remote' => $profile::puppet::params::remote,
'basedir' => $environmentpath,
'prefix' => false,
},
},
purgedirs => [$environmentpath],
manage_modulepath => false,
mcollective => true,
notify => Service['pe-puppetserver'],
}

if $autosign {
file { 'autosign':
ensure => 'present',
Expand Down
1 change: 1 addition & 0 deletions site/profile/manifests/puppet/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
class profile::puppet::params {
$hieradir = '"/etc/puppetlabs/puppet/environments/%{::environment}/hieradata"'
$basemodulepath = "${::settings::confdir}/modules:/opt/puppet/share/puppet/modules"
$environmentpath = "${::settings::confdir}/environments"
case $::settings::server {
'xmaster.vagrant.vm': {
$remote = '/vagrant'
Expand Down
12 changes: 12 additions & 0 deletions site/profile/manifests/puppet/r10k.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class profile::puppet::r10k (
$remote = $::profile::puppet::params::remote,
$environmentpath = $::profile::puppet::params::environmentpath,
) inherits ::profile::puppet::params {
file { 'r10k_config':
ensure => file,
owner => 'root',
group => 'root',
path => '/etc/puppetlabs/r10k/r10k.yaml',
content => template('profile/r10k.yaml.erb'),
}
}
4 changes: 4 additions & 0 deletions site/profile/templates/r10k.yaml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
mysource:
remote: <%= @remote %>
basedir: <%= @environmentpath %>
1 change: 0 additions & 1 deletion site/role/manifests/puppet/master.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
class role::puppet::master {
include profile::base
include profile::base::linux
include profile::puppet::master
}
4 changes: 2 additions & 2 deletions vagrant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ nodes:
synced_folders:
- host: .
guest: /vagrant
xagent1:
hostname: xagent1.vagrant.vm
xagent:
hostname: xagent.vagrant.vm
box: puppetlabs/centos-6.6-64-nocm
memory: 512
cpus: 1
Expand Down

0 comments on commit 7600170

Please sign in to comment.