Permalink
Browse files

Add global option --exclude-servers=EXCLUDE_SERVERS

This is a comma separated list of servers to be excluded from
installation in case you are running Packstack the second time
with the same answer file and don't want Packstack to touch
these servers.

For example, suppose that you've already installed the following
hosts:

  - Controller node : 10.0.0.99
  - Compute nodes   : 10.0.0.100 - 10.0.0.110

and you want add one more compute node 10.0.0.111.

Then you can reuse the previous answer file with the following
modification:

 - Add 10.0.0.111 to NOVACOMPUTE_HOSTS
 - Add existing hosts (10.0.0.99 - 10.0.0.110) to EXCLUDE_SERVERS

This avoids applying puppet modules to existing hosts again.

(In theory, because of idempotentness of puppet manifests,
applying the same modules does no harm. But it is a waste of time
and has a potential risk of breaking manual configurations which
has been done after the packstack installation.)

Change-Id: Ib3dcd94a25a286f82cc0fcedebd1824b1d27d864
  • Loading branch information...
Etsuji Nakai
Etsuji Nakai committed Jul 6, 2013
1 parent f048f00 commit 13a2f677ed20d585cfa1b62e29f070c2fa8367ec
Showing with 23 additions and 3 deletions.
  1. +11 −0 packstack/plugins/prescript_000.py
  2. +12 −3 packstack/plugins/puppet_950.py
@@ -133,6 +133,17 @@ def initConfig(controllerObject):
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
{"CMD_OPTION" : "exclude-servers",
"USAGE" : "Comma separated list of servers to be excluded from installation in case you are running Packstack the second time with the same answer file and don't want Packstack to touch these servers. Leave plain if you don't need to exclude any server.",
"PROMPT" : "Enter a comma separated list of server(s) to be excluded. Leave plain if you don't need to exclude any server.",
"OPTION_LIST" : [],
"DEFAULT_VALUE" : '',
"MASK_INPUT" : False,
"LOOSE_VALIDATION": False,
"CONF_NAME" : "EXCLUDE_SERVERS",
"USE_DEFAULT" : False,
"NEED_CONFIRM" : False,
"CONDITION" : False },
]
groupDict = { "GROUP_NAME" : "GLOBAL",
"DESCRIPTION" : "Global Options",
@@ -46,6 +46,15 @@ def initConfig(controllerObject):
controller.addGroup(groupDict, paramsList)
def getinstallhostlist(conf):
list = []
exclude_list = map(str.strip, conf['EXCLUDE_SERVERS'].split(','))
for host in gethostlist(conf):
if host not in exclude_list:
list.append(host)
return list
def initSequences(controller):
puppetpresteps = [
{'title': 'Clean Up', 'functions':[runCleanup]},
@@ -67,7 +76,7 @@ def runCleanup(config):
def installdeps(config):
for hostname in gethostlist(controller.CONF):
for hostname in getinstallhostlist(controller.CONF):
server = utils.ScriptRunner(hostname)
for package in ("puppet", "openssh-clients", "tar", "nc"):
server.append("rpm -q %s || yum install -y %s" % (package, package))
@@ -90,7 +99,7 @@ def copyPuppetModules(config):
tar_opts = ""
if platform.linux_distribution()[0] == "Fedora":
tar_opts += "--exclude create_resources "
for hostname in gethostlist(controller.CONF):
for hostname in getinstallhostlist(controller.CONF):
host_dir = controller.temp_map[hostname]
puppet_dir = os.path.join(host_dir, basedefs.PUPPET_MANIFEST_RELATIVE)
server.append("cd %s/puppet" % basedefs.DIR_PROJECT_DIR)
@@ -181,7 +190,7 @@ def applyPuppetManifest(config):
waitforpuppet(currently_running)
lastmarker = marker
for hostname in gethostlist(controller.CONF):
for hostname in getinstallhostlist(controller.CONF):
if "%s_" % hostname not in manifest:
continue

0 comments on commit 13a2f67

Please sign in to comment.