Support deployment blacklist with --limit

Add support for the DeploymentServerBlacklist template parameter by
using Ansible's --limit cli arg.

Change-Id: If17d2aeb4efaae3b830c7b8ca7101fde4072abd6
Depends-On: I4705be446756869ba3d04fc59daffa4d4748e12c
(cherry picked from commit 4bed1005e0)
This commit is contained in:
James Slagle 2018-05-01 17:54:02 -04:00
parent d93e12e4a1
commit 698731ef4b
2 changed files with 22 additions and 0 deletions

View File

@ -281,6 +281,8 @@ class AnsiblePlaybookAction(base.TripleOAction):
self.profile_tasks = self._kwargs_for_run.pop('profile_tasks', True)
self.profile_tasks_limit = self._kwargs_for_run.pop(
'profile_tasks_limit', 0)
self.blacklisted_hostnames = self._kwargs_for_run.pop(
'blacklisted_hostnames', [])
@property
def work_dir(self):
@ -437,6 +439,11 @@ class AnsiblePlaybookAction(base.TripleOAction):
if self.ssh_private_key:
command.extend(['--private-key', self.ssh_private_key])
if self.blacklisted_hostnames:
host_pattern = ':'.join(
['!%s' % h for h in self.blacklisted_hostnames])
command.extend(['--limit', host_pattern])
if self.tags:
command.extend(['--tags', self.tags])

View File

@ -279,12 +279,26 @@ workflows:
- plan_name: overcloud
- work_dir: /var/lib/mistral
- verbosity: 1
- blacklist: []
tags:
- tripleo-common-managed
tasks:
get_blacklisted_hostnames:
action: heat.stacks_output_show
input:
stack_id: <% $.plan_name %>
output_key: BlacklistedHostnames
publish:
blacklisted_hostnames: <% task().result.output.output_value %>
on-success: get_config
on-error: send_message
publish-on-error:
status: FAILED
message: <% task().result %>
get_config:
action: tripleo.config.get_overcloud_config
input:
@ -387,6 +401,7 @@ workflows:
queue_name: <% $.queue_name %>
reproduce_command: true
trash_output: true
blacklisted_hostnames: <% $.blacklisted_hostnames %>
publish:
log_path: <% task(run_ansible).result.get('log_path') %>
on-success: