Remove global variables from manifest/site.pp
We have one global variable that is used in two places. By removing it, we can more easily split site.pp into per-service manifest files, and ultimately we should be deriving this from groups['elasticsearch'] anyway. Change-Id: I1d794b269847da85778f71e816359953af9b31e0
This commit is contained in:
parent
5468f49254
commit
3e4d99b6fd
@ -1,22 +1,3 @@
|
|||||||
#
|
|
||||||
# Top-level variables
|
|
||||||
#
|
|
||||||
# There must not be any whitespace between this comment and the variables or
|
|
||||||
# in between any two variables in order for them to be correctly parsed and
|
|
||||||
# passed around in test.sh
|
|
||||||
#
|
|
||||||
# Note we do not do a hiera lookup here as we set $group on a per node basis
|
|
||||||
# and that must be set before we can do hiera lookups. Doing a hiera lookup
|
|
||||||
# here would fail to find any group specific info.
|
|
||||||
$elasticsearch_nodes = [
|
|
||||||
"elasticsearch02.openstack.org",
|
|
||||||
"elasticsearch03.openstack.org",
|
|
||||||
"elasticsearch04.openstack.org",
|
|
||||||
"elasticsearch05.openstack.org",
|
|
||||||
"elasticsearch06.openstack.org",
|
|
||||||
"elasticsearch07.openstack.org",
|
|
||||||
]
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Default: should at least behave like an openstack server
|
# Default: should at least behave like an openstack server
|
||||||
#
|
#
|
||||||
@ -225,6 +206,15 @@ node /^logstash\d*\.open.*\.org$/ {
|
|||||||
node /^logstash-worker\d+\.open.*\.org$/ {
|
node /^logstash-worker\d+\.open.*\.org$/ {
|
||||||
$group = 'logstash-worker'
|
$group = 'logstash-worker'
|
||||||
|
|
||||||
|
$elasticsearch_nodes = [
|
||||||
|
'elasticsearch02.openstack.org',
|
||||||
|
'elasticsearch03.openstack.org',
|
||||||
|
'elasticsearch04.openstack.org',
|
||||||
|
'elasticsearch05.openstack.org',
|
||||||
|
'elasticsearch06.openstack.org',
|
||||||
|
'elasticsearch07.openstack.org',
|
||||||
|
]
|
||||||
|
|
||||||
class { 'openstack_project::server': }
|
class { 'openstack_project::server': }
|
||||||
|
|
||||||
class { 'openstack_project::logstash_worker':
|
class { 'openstack_project::logstash_worker':
|
||||||
@ -250,6 +240,16 @@ node /^subunit-worker\d+\.open.*\.org$/ {
|
|||||||
# Node-OS: xenial
|
# Node-OS: xenial
|
||||||
node /^elasticsearch\d+\.open.*\.org$/ {
|
node /^elasticsearch\d+\.open.*\.org$/ {
|
||||||
$group = "elasticsearch"
|
$group = "elasticsearch"
|
||||||
|
|
||||||
|
$elasticsearch_nodes = [
|
||||||
|
'elasticsearch02.openstack.org',
|
||||||
|
'elasticsearch03.openstack.org',
|
||||||
|
'elasticsearch04.openstack.org',
|
||||||
|
'elasticsearch05.openstack.org',
|
||||||
|
'elasticsearch06.openstack.org',
|
||||||
|
'elasticsearch07.openstack.org',
|
||||||
|
]
|
||||||
|
|
||||||
class { 'openstack_project::server': }
|
class { 'openstack_project::server': }
|
||||||
class { 'openstack_project::elasticsearch_node':
|
class { 'openstack_project::elasticsearch_node':
|
||||||
discover_nodes => $elasticsearch_nodes,
|
discover_nodes => $elasticsearch_nodes,
|
||||||
|
@ -22,18 +22,15 @@ fi
|
|||||||
|
|
||||||
trap "mv ~/applytest applytest" EXIT
|
trap "mv ~/applytest applytest" EXIT
|
||||||
|
|
||||||
# First split the variables at the beginning of the file
|
# Split the class defs.
|
||||||
csplit -sf ~/applytest/prep $PUPPET_MANIFEST '/^$/' {0}
|
csplit -sf ~/applytest/puppetapplytest $PUPPET_MANIFEST '/^}$/' {*}
|
||||||
# Then split the class defs.
|
|
||||||
csplit -sf ~/applytest/puppetapplytest ~/applytest/prep01 '/^}$/' {*}
|
|
||||||
# Remove } header left by csplit
|
# Remove } header left by csplit
|
||||||
sed -i -e '/^\}$/d' ~/applytest/puppetapplytest*
|
sed -i -e '/^\}$/d' ~/applytest/puppetapplytest*
|
||||||
# Comment out anything that doesn't begin with a space.
|
# Comment out anything that doesn't begin with a space.
|
||||||
# This gives us the node {} internal contents.
|
# This gives us the node {} internal contents.
|
||||||
sed -i -e 's/^[^][:space:]$]/#&/g' ~/applytest/prep00 ~/applytest/puppetapplytest*
|
sed -i -e 's/^[^][:space:]$]/#&/g' ~/applytest/puppetapplytest*
|
||||||
sed -i -e 's@hiera(.\([^.]*\).,\([^)]*\))@\2@' ~/applytest/prep00 ~/applytest/puppetapplytest*
|
sed -i -e 's@hiera(.\([^.]*\).,\([^)]*\))@\2@' ~/applytest/puppetapplytest*
|
||||||
sed -i -e "s@hiera(.\([^.]*\).)@'\1NoDefault'@" ~/applytest/prep00 ~/applytest/puppetapplytest*
|
sed -i -e "s@hiera(.\([^.]*\).)@'\1NoDefault'@" ~/applytest/puppetapplytest*
|
||||||
mv ~/applytest/prep00 ~/applytest/head # These are the top-level variables defined in site.pp
|
|
||||||
|
|
||||||
if [[ `lsb_release -i -s` == 'CentOS' ]]; then
|
if [[ `lsb_release -i -s` == 'CentOS' ]]; then
|
||||||
if [[ `lsb_release -r -s` =~ '7' ]]; then
|
if [[ `lsb_release -r -s` =~ '7' ]]; then
|
||||||
@ -55,7 +52,7 @@ for f in `find ~/applytest -name 'puppetapplytest*' -print` ; do
|
|||||||
echo "Skipping $f due to unsupported puppet version"
|
echo "Skipping $f due to unsupported puppet version"
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
cat ~/applytest/head $f > $f.final
|
cp $f $f.final
|
||||||
FOUND=1
|
FOUND=1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user