workbooks/deployment: add support to filter nodes when running Ansible

In run_ansible task, adding support to filter nodes with limit_hosts
(--limit option in Ansible), so we can call the workbook with the desire
to run Ansible only on certain hosts (e.g. scale down).

Change-Id: I1aa086cc706110905b7a45a765d67d01ee90434e
This commit is contained in:
Emilien Macchi 2019-05-07 10:31:36 +02:00
parent 2c3f7533f6
commit 68334a0041

View File

@ -387,6 +387,7 @@ workflows:
- blacklist: []
- override_ansible_cfg: ""
- config_download_timeout: 14400
- nodes: []
tags:
- tripleo-common-managed
@ -463,7 +464,15 @@ workflows:
execution: <% execution() %>
message: Config downloaded at <% $.get('work_dir') %>/<% $.get('plan_name') %>
plan_name: <% $.plan_name %>
on-success: uuids_to_names
uuids_to_names:
action: ironic.node_get_by_instance_uuid
on-success: get_private_key
input:
instance_uuid: <% $.node %>
fields: ['instance_info']
with-items: node in <% $.nodes %>
get_private_key:
action: tripleo.validations.get_privkey
@ -541,6 +550,7 @@ workflows:
override_ansible_cfg: <% $.override_ansible_cfg %>
command_timeout: <% $.config_download_timeout %>
execution_id: <% execution().id %>
limit_hosts: <% $.nodes and list(task(uuids_to_names).result.instance_info.display_name).join(',') or false %>
publish:
log_path: <% task().result.get('log_path') %>
deployment_status: DEPLOY_SUCCESS