---
- name: Set contrail_masters from contrail_control_data_interface
  set_fact:
    contrail_masters: "{{ contrail_control_data_interface }}"
  when:
    - contrail_control_data_interface is defined

- name: Set contrail_masters from infra nodes
  set_fact:
    contrail_masters: "{{ contrail_masters }} {{ item }}"
  when:
    - contrail_control_data_interface is not defined
    - hostvars[item]['openshift_node_group_name'] is defined
    - hostvars[item]['openshift_node_group_name'] == contrail_node_group
  with_items: "{{ groups.nodes }}"
