Add Puppetfile and install script

This repo will be cloned by the puppet modules and used to install
modules in functional tests. The script uses r10k to deploy modules
from the Puppetfile because this is the Puppet Labs recommended way to
manage puppet environments, and it is a popular method among our users.
We install all modules from git, not the forge, because r10k does not
give us dependency resolution so installing from the forge does not buy
us anything. If the modules have stable branches in git, r10k uses the
stable branch as a ref, otherwise it uses a tag (pinning to a specific
release).

If zuul-cloner is available, the script first installs the external
modules with r10k, then extracts the OpenStack modules from the
Puppetfile to install with zuul-cloner. In the future, this part may be
split out into a JJB job.

Note: because r10k purges the modules directory before installing
modules, and this feature cannot be turned off[1], we must run r10k to
install the external modules before running zuul-cloner to install the
OpenStack modules.

[1] https://github.com/puppetlabs/r10k/issues/172

Change-Id: Ide59ef4bdf53a04957e3593815b7514a0e744e0e
This commit is contained in:
Colleen Murphy 2015-06-30 16:59:52 -07:00
parent a3ec2e2b5e
commit ec2457a301
2 changed files with 214 additions and 0 deletions

167
Puppetfile Normal file
View File

@ -0,0 +1,167 @@
# OpenStack modules
mod 'ceilometer',
:git => 'https://git.openstack.org/openstack/puppet-ceilometer',
:ref => 'master'
mod 'cinder',
:git => 'https://git.openstack.org/openstack/puppet-cinder',
:ref => 'master'
mod 'designate',
:git => 'https://git.openstack.org/openstack/puppet-designate',
:ref => 'master'
mod 'glance',
:git => 'https://git.openstack.org/openstack/puppet-glance',
:ref => 'master'
mod 'gnocchi',
:git => 'https://git.openstack.org/openstack/puppet-gnocchi',
:ref => 'master'
mod 'heat',
:git => 'https://git.openstack.org/openstack/puppet-heat',
:ref => 'master'
mod 'horizon',
:git => 'https://git.openstack.org/openstack/puppet-horizon',
:ref => 'master'
mod 'ironic',
:git => 'https://git.openstack.org/openstack/puppet-ironic',
:ref => 'master'
mod 'keystone',
:git => 'https://git.openstack.org/openstack/puppet-keystone',
:ref => 'master'
mod 'manila',
:git => 'https://git.openstack.org/openstack/puppet-manila',
:ref => 'master'
mod 'monasca',
:git => 'https://git.openstack.org/openstack/puppet-monasca',
:ref => 'master'
mod 'neutron',
:git => 'https://git.openstack.org/openstack/puppet-neutron',
:ref => 'master'
mod 'nova',
:git => 'https://git.openstack.org/openstack/puppet-nova',
:ref => 'master'
mod 'openstack_extras',
:git => 'https://git.openstack.org/openstack/puppet-openstack_extras',
:ref => 'master'
mod 'openstacklib',
:git => 'https://git.openstack.org/openstack/puppet-openstacklib',
:ref => 'master'
mod 'sahara',
:git => 'https://git.openstack.org/openstack/puppet-sahara',
:ref => 'master'
mod 'swift',
:git => 'https://git.openstack.org/openstack/puppet-swift',
:ref => 'master'
mod 'tempest',
:git => 'https://git.openstack.org/openstack/puppet-tempest',
:ref => 'master'
mod 'trove',
:git => 'https://git.openstack.org/openstack/puppet-trove',
:ref => 'master'
mod 'tuskar',
:git => 'https://git.openstack.org/openstack/puppet-tuskar',
:ref => 'master'
mod 'vswitch',
:git => 'https://git.openstack.org/openstack/puppet-vswitch',
:ref => 'master'
mod 'zaqar',
:git => 'https://git.openstack.org/openstack/puppet-zaqar',
:ref => 'master'
# External modules
mod 'apache',
:git => 'https://github.com/puppetlabs/puppetlabs-apache',
:branch => '1.4.x'
mod 'apt',
:git => 'https://github.com/puppetlabs/puppetlabs-apt',
:branch => '1.8.x'
mod 'concat',
:git => 'https://github.com/puppetlabs/puppetlabs-concat',
:branch => '1.2.x'
mod 'dns',
:git => 'https://github.com/theforeman/puppet-dns',
:tag => '3.0.0'
mod 'firewall',
:git => 'https://github.com/puppetlabs/puppetlabs-firewall',
:branch => '1.6.x'
mod 'inifile',
:git => 'https://github.com/puppetlabs/puppetlabs-inifile',
:branch => '1.3.x'
mod 'memcached',
:git => 'https://github.com/saz/puppet-memcached',
:tag => 'v2.8.1'
mod 'mongodb',
:git => 'https://github.com/puppetlabs/puppetlabs-mongodb',
:branch => '0.11.0'
mod 'mysql',
:git => 'https://github.com/puppetlabs/puppetlabs-mysql',
:branch => '3.4.x'
mod 'postgresql',
:git => 'https://github.com/puppetlabs/puppetlabs-postgresql',
:branch => '4.4.x'
mod 'python',
:git => 'https://github.com/stankevich/puppet-python',
:tag => '1.9.4'
mod 'qpid',
:git => 'https://github.com/dprince/puppet-qpid',
:tag => '1.0.2'
mod 'rabbitmq',
:git => 'https://github.com/puppetlabs/puppetlabs-rabbitmq',
:tag => '5.2.3'
mod 'rsync',
:git => 'https://github.com/puppetlabs/puppetlabs-rsync',
:tag => '0.4.0'
mod 'staging',
:git => 'https://github.com/nanliu/puppet-staging',
:tag => '1.0.4'
mod 'stdlib',
:git => 'https://github.com/puppetlabs/puppetlabs-stdlib',
:branch => '4.6.x'
mod 'sysctl',
:git => 'https://github.com/duritong/puppet-sysctl',
:tag => 'v0.0.11'
mod 'vcsrepo',
:git => 'https://github.com/puppetlabs/puppetlabs-vcsrepo',
:branch => '1.3.x'
mod 'xinetd',
:git => 'https://github.com/puppetlabs/puppetlabs-xinetd',
:tag => '1.5.0'

47
install_modules.sh Normal file
View File

@ -0,0 +1,47 @@
#!/bin/bash
set -ex
export SCRIPT_DIR=$(readlink -f "$(dirname $0)")
export PUPPETFILE_DIR=/etc/puppet/modules
install_external() {
PUPPETFILE=${SCRIPT_DIR}/Puppetfile1 r10k puppetfile install -v
}
install_openstack() {
cat > clonemap.yaml <<EOF
clonemap:
- name: '(.*?)/puppet-(.*)'
dest: '/etc/puppet/modules/\2'
EOF
local project_names=$(awk '{ if ($1 == ":git") print $3 }' \
${SCRIPT_DIR}/Puppetfile0 | tr -d "'," | cut -d '/' -f 4- | xargs
)
/usr/zuul-env/bin/zuul-cloner -m clonemap.yaml \
--cache-dir /opt/git \
--zuul-ref $ZUUL_REF \
--zuul-branch $ZUUL_BRANCH \
--zuul-url $ZUUL_URL \
git://git.openstack.org $project_names
}
install_all() {
PUPPETFILE=${SCRIPT_DIR}/Puppetfile r10k puppetfile install -v
}
gem install r10k --no-ri --no-rdoc
# If zuul-cloner is there, have it install modules using zuul refs
if [ -e /usr/zuul-env/bin/zuul-cloner ] ; then
csplit ${SCRIPT_DIR}/Puppetfile /'External modules'/ \
--prefix ${SCRIPT_DIR}/Puppetfile \
--suffix '%d'
install_external
install_openstack
else
install_all
fi
puppet module list