Add support for install puppet modules.
Change-Id: I0fb81d64daea389a564405c76773108eaeec6684
This commit is contained in:
parent
8c001acda4
commit
40471655d3
@ -43,7 +43,7 @@ host for use by the OpenStack project.
|
||||
sudo apt-get install puppet git openjdk-6-jre-headless mysql-server
|
||||
git clone git://github.com/openstack/openstack-ci-puppet.git
|
||||
cd openstack-ci-puppet/
|
||||
sudo puppet apply --modulepath=modules manifests/site.pp
|
||||
sudo bash run_puppet.sh
|
||||
|
||||
Install MySQL
|
||||
-------------
|
||||
|
11
install_modules.sh
Normal file
11
install_modules.sh
Normal file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
|
||||
MODULES="puppetlabs-mysql"
|
||||
MODULE_LIST=`puppet module list`
|
||||
|
||||
for MOD in $MODULES ; do
|
||||
if ! echo $MODULE_LIST | grep $MOD >/dev/null 2>&1 ; then
|
||||
# This will get run in cron, so silence non-error output
|
||||
puppet module install $MOD >/dev/null
|
||||
fi
|
||||
done
|
@ -35,7 +35,7 @@ node "community.openstack.org" {
|
||||
}
|
||||
|
||||
node "ci-puppetmaster.openstack.org" {
|
||||
include openstack_project::puppet_cron
|
||||
include openstack_project::remove_cron
|
||||
include openstack_project::puppetmaster
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@ class openstack_project::puppet_cron {
|
||||
cron { "updatepuppet":
|
||||
user => root,
|
||||
minute => "*/15",
|
||||
command => 'apt-get update >/dev/null 2>&1 ; sleep $((RANDOM\%600)) && cd /root/openstack-ci-puppet && /usr/bin/git pull -q && puppet apply -l /var/log/manifest.log --modulepath=/root/openstack-ci-puppet/modules manifests/site.pp',
|
||||
command => 'apt-get update >/dev/null 2>&1 ; sleep $((RANDOM\%600)) && /bin/bash /root/openstack-ci-puppet/run_puppet.sh /root/openstack-ci-puppet',
|
||||
environment => "PATH=/var/lib/gems/1.8/bin:/usr/bin:/bin:/usr/sbin:/sbin",
|
||||
}
|
||||
logrotate::file { 'updatepuppet':
|
||||
|
@ -5,7 +5,7 @@ class openstack_project::puppetmaster {
|
||||
cron { "updatepuppetmaster":
|
||||
user => root,
|
||||
minute => "*/15",
|
||||
command => 'sleep $((RANDOM\%600)) && cd /opt/openstack-ci-puppet/production && /usr/bin/git pull -q',
|
||||
command => 'sleep $((RANDOM\%600)) && cd /opt/openstack-ci-puppet/production && /usr/bin/git pull -q && /bin/bash install_modules.sh',
|
||||
environment => "PATH=/var/lib/gems/1.8/bin:/usr/bin:/bin:/usr/sbin:/sbin",
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ start on runlevel[2345]
|
||||
script
|
||||
cd /root/openstack-ci-puppet/modules
|
||||
/usr/bin/git pull --ff-only
|
||||
echo "Installing modules" >> /var/log/manifest.log
|
||||
/bin/bash install_modules.sh >> /var/log/manifest.log
|
||||
echo "Running puppet on boot" >> /var/log/manifest.log
|
||||
date >> /var/log/manifest.log
|
||||
/usr/bin/puppet apply --modulepath=/root/openstack-ci-puppet/modules -l /var/log/manifest.log /root/openstack-ci-puppet/manifests/site.pp
|
||||
|
16
run_puppet.sh
Normal file
16
run_puppet.sh
Normal file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
if ! test -z $1 ; then
|
||||
BASE_DIR=$1
|
||||
else
|
||||
BASE_DIR=`pwd`
|
||||
fi
|
||||
|
||||
MODULE_DIR=${BASE_DIR}/modules
|
||||
MODULE_PATH=${MODULE_DIR}:/etc/puppet/modules
|
||||
MANIFEST_LOG=/var/log/manifest.log
|
||||
|
||||
cd $BASE_DIR
|
||||
/usr/bin/git pull -q && \
|
||||
/bin/bash install_modules.sh && \
|
||||
/usr/bin/puppet apply -l $MANIFEST_LOG --modulepath=$MODULE_PATH manifests/site.pp
|
Loading…
Reference in New Issue
Block a user