Fix update tasks for openshift

While introducing the openshift-node service in 7373adc72e, some code
was moved around and that broke the OpenShift external_deploy_task
playbook in the case of a stack update due to undefined ansible
variable.

Rename the new_masters var into new_master_nodes and introduce the
has_new_nodes boolean var that indicates there is at least one new node
in the deployment.

Related-Bug: 1794824

Change-Id: I2f386b5507836deda0816616dd7add8a0b53dfd3
(cherry picked from commit 73c3cd4181)
This commit is contained in:
Martin André 2018-10-08 14:26:18 +02:00
parent f78ee0834d
commit 2cd338a7e2
2 changed files with 6 additions and 3 deletions

View File

@ -363,11 +363,11 @@ outputs:
- include: "{{openshift_prerequisites_playbook_path}}"
{% if tripleo_stack_action == 'UPDATE' and new_masters | count > 0 %}
{% if tripleo_stack_action == 'UPDATE' and new_master_nodes | count > 0 %}
- include: "{{openshift_master_scaleup_playbook_path}}"
{% endif %}
{% if tripleo_stack_action == 'UPDATE' and new_nodes | count > 0 %}
{% if tripleo_stack_action == 'UPDATE' and has_new_nodes %}
- include: "{{openshift_worker_scaleup_playbook_path}}"
{% endif %}
@ -375,7 +375,7 @@ outputs:
- include: "{{openshift_upgrade_playbook_path}}"
{% endif %}
{% if tripleo_stack_action == 'CREATE' or (tripleo_stack_action == 'UPDATE' and (new_masters + new_nodes) | count == 0) %}
{% if tripleo_stack_action == 'CREATE' or (tripleo_stack_action == 'UPDATE' and has_new_nodes) %}
- include: "{{openshift_ansible_playbook_path}}"
{% endif %}

View File

@ -112,6 +112,9 @@ outputs:
role_nodes: "{{all_role_nodes.results | map(attribute='ansible_facts') | map(attribute='nodes') | flatten | list}}"
new_role_nodes: "{{all_role_nodes.results | map(attribute='ansible_facts') | map(attribute='nodes') | flatten | selectattr('new_node', 'equalto', True) | list}}"
- set_fact:
has_new_nodes: "{{ (has_new_nodes | default(False)) or new_role_nodes | count > 0 }}"
- name: generate openshift inventory for {{tripleo_role_name}} role nodes
copy:
dest: "{{playbook_dir}}/openshift/inventory/{{tripleo_role_name}}_nodes.yml"