diff --git a/defaults/main.yml b/defaults/main.yml index 79a95f12..14af2e20 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -238,5 +238,8 @@ upgrade_remove_rpm: false # List of roles deployed in overcloud oc_roles: [] +# Roles upgrade order +roles_upgrade_order: '__undefined__' + # Packet loss threshold for a ping test loss_threshold: 1 diff --git a/tasks/common/load_roles_from_inventory.yaml b/tasks/common/load_roles_from_inventory.yaml index 45372b46..96868c03 100644 --- a/tasks/common/load_roles_from_inventory.yaml +++ b/tasks/common/load_roles_from_inventory.yaml @@ -21,6 +21,12 @@ when: item|regex_search('[A-Za-z0-9]*[Cc]ontroller[A-Za-z0-9]*') with_items: "{{ oc_roles }}" -- name: store sorted roles with controller first +- name: store sorted roles with controller first(default) set_fact: oc_roles: "{{ oc_roles|intersect([controller_role_name]) + oc_roles|difference([controller_role_name]) }}" + when: roles_upgrade_order == '__undefined__' + +- name: store sorted roles with controller first(user-defined) + set_fact: + oc_roles: "{{ roles_upgrade_order.split(';') }}" + when: roles_upgrade_order != '__undefined__'