Add puppet_run_type config to setup.pp

Currently, setup.pp configures every node as
if they were a master (or a node that needs to
run puppet apply). This configuration is unnecessary
and even undesirable for agents b/c it deploys
hiera data they don't need and even enables then to use
a node terminus.

This patch adds a variable to setup.pp called puppet_run_type
that can be used to determine if the node is being
pre-confgigured as a agent or a master.

It also updates the Vagrantfile as well as the bare-metal install
scripts.
This commit is contained in:
Dan Bode
2013-10-10 12:12:55 -07:00
parent ca2dede645
commit daf245e520
5 changed files with 40 additions and 31 deletions

View File

@@ -169,19 +169,9 @@ More information about this tool can be found under the stack-builder directory.
### install your build server
first, log into your build server, and set it up:
first, log into your build server, and run the following script to bootstrap it as a puppet master:
export build_server_ip=X.X.X.X ; bash <(curl -fsS https://raw.github.com/CiscoSystems/openstack-installer/master/install-scripts/setup.sh)
then, install it as a puppet master
bash /root/openstack-installer/install-scripts/master.sh
download all plugins for your puppetmaster
``
puppet plugin download --server `hostname -f`; service apache2 restart
``
export build_server_ip=X.X.X.X ; bash <(curl -fsS https://raw.github.com/CiscoSystems/openstack-installer/master/install-scripts/master.sh)
### set up your data

5
Vagrantfile vendored
View File

@@ -116,7 +116,7 @@ end
#
# run puppet apply on the site manifest
#
def apply_manifest(config, v_config, manifest_name='site.pp', certname=nil)
def apply_manifest(config, v_config, manifest_name='site.pp', certname=nil, puppet_type=nil)
options = []
@@ -161,6 +161,7 @@ def apply_manifest(config, v_config, manifest_name='site.pp', certname=nil)
puppet.facter = {
"build_server_ip" => "192.168.242.100",
"build_server_domain_name" => v_config['domain'],
"puppet_run_mode" => puppet_type,
}
end
@@ -230,7 +231,7 @@ def configure_openstack_node(
configure_apt_mirror(config, v_config['apt_mirror'], apt_cache_proxy)
end
apply_manifest(config, v_config, 'setup.pp')
apply_manifest(config, v_config, 'setup.pp', nil, puppet_type)
if puppet_type == 'apply'
apply_manifest(config, v_config, 'site.pp', cert_name)

View File

@@ -2,10 +2,16 @@
#
# this script converts the node
# it runs on into a puppetmaster/build-server
# It assumes that setup.sh has already been run.
#
export build_server_ip="${build_server_ip:-127.0.0.1}"
export puppet_run_mode="apply"
bash <(curl -fsS https://raw.github.com/CiscoSystems/openstack-installer/master/install-scripts/setup.sh)
cp -Rv /root/openstack-installer/modules /etc/puppet/
cp -Rv /root/openstack-installer/data /etc/puppet/
cp -Rv /root/openstack-installer/manifests /etc/puppet/
puppet apply /etc/puppet/manifests/site.pp --certname build-server --debug
puppet plugin download --server `hostname -f`; service apache2 restart

View File

@@ -39,5 +39,6 @@ librarian-puppet install --verbose
export FACTER_build_server_domain_name=$domain
export FACTER_build_server_ip=$build_server_ip
export FACTER_puppet_run_mode="${puppet_run_mode:-agent}"
puppet apply manifests/setup.pp --modulepath modules

View File

@@ -24,10 +24,6 @@ case $::osfamily {
$pkg_list = ['git', 'curl', 'vim', 'cobbler']
package { 'puppet-common':
ensure => $puppet_version,
} ->
package { 'puppetmaster-common':
ensure => $puppet_version,
before => Package['puppet'],
}
}
}
@@ -44,9 +40,23 @@ if $::build_server_ip {
}
}
# set up our hiera-store!
file { "${settings::confdir}/hiera.yaml":
content =>
#
# configure data or all machines who
# have run mode set to master or apply
#
if $::puppet_run_mode != 'agent' {
if $::osfamily == 'Debian' {
package { 'puppetmaster-common':
ensure => $puppet_version,
before => Package['puppet'],
require => Package['puppet-common']
}
}
# set up our hiera-store!
file { "${settings::confdir}/hiera.yaml":
content =>
'
---
:backends:
@@ -76,16 +86,17 @@ file { "${settings::confdir}/hiera.yaml":
# this should be contained in a module
:datadir: /etc/puppet/data/data_mappings
'
}
}
# add the correct node terminus
ini_setting {'puppetmastermodulepath':
ensure => present,
path => '/etc/puppet/puppet.conf',
section => 'main',
setting => 'node_terminus',
value => 'scenario',
require => Package['puppet'],
# add the correct node terminus
ini_setting {'puppetmastermodulepath':
ensure => present,
path => '/etc/puppet/puppet.conf',
section => 'main',
setting => 'node_terminus',
value => 'scenario',
require => Package['puppet'],
}
}
# lay down a file that can be used for subsequent runs to puppet. Often, the