diff --git a/README.md b/README.md index 1726b8d..fd4ffaa 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/Vagrantfile b/Vagrantfile index a313ec8..048af4a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -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) diff --git a/install-scripts/master.sh b/install-scripts/master.sh index fa82ebb..d8c7223 100644 --- a/install-scripts/master.sh +++ b/install-scripts/master.sh @@ -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 diff --git a/install-scripts/setup.sh b/install-scripts/setup.sh index 6cda62c..0d5a0c9 100644 --- a/install-scripts/setup.sh +++ b/install-scripts/setup.sh @@ -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 diff --git a/manifests/setup.pp b/manifests/setup.pp index 62fd890..9d61822 100644 --- a/manifests/setup.pp +++ b/manifests/setup.pp @@ -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