Add new oc_hosts_roles variable.

With the new upgrades workflow we need to perform a more
granular upgrade node by node, instead of by role as we
were doing before. For that reason, we're adding a new
variable which contains all the hosts an ansible group
consists of. So we can iterate over them at the time of
upgrading.

Change-Id: I81f4add06218ad201d4772821723154c33d4123e
This commit is contained in:
Jose Luis Franco Arza 2019-03-15 14:02:32 +01:00
parent 8858045292
commit db7e04bc5e
2 changed files with 14 additions and 0 deletions

View File

@ -237,6 +237,13 @@ upgrade_remove_rpm: false
# List of roles deployed in overcloud
oc_roles: []
# Dictionary with roles and hosts per role
# oc_roles_hosts: {
# 'Controller' : ["controller-0", "controller-1", "controller-2"],
# 'Compute' : ["compute-0"]
# }
oc_roles_hosts: {}
# Roles upgrade order
roles_upgrade_order: '__undefined__'

View File

@ -30,3 +30,10 @@
set_fact:
oc_roles: "{{ roles_upgrade_order.split(';') }}"
when: roles_upgrade_order != '__undefined__'
- name: create hosts per role fact
vars:
inventory_yaml: "{{ upgrade_tripleo_inventory.stdout | from_yaml }}"
set_fact:
oc_roles_hosts: "{{ oc_roles_hosts | combine({ item.key : inventory_yaml[item.key]['hosts'].keys() }) }}"
with_dict: "{{ inventory_yaml.overcloud.children }}"