Merge "Only set Ironic port attributes when changed"
This commit is contained in:
commit
b3f934a951
|
@ -17,14 +17,30 @@
|
|||
set_fact:
|
||||
bridge: "{{ physnet | bridge_name }}"
|
||||
|
||||
- name: Get existing Ironic port attributes
|
||||
command: >-
|
||||
{{ ironic_virtualenv_path }}/bin/openstack baremetal port show
|
||||
{{ uuid.stdout }} -f json
|
||||
register: port_attributes_output
|
||||
changed_when: false
|
||||
|
||||
- name: Set Ironic port attributes
|
||||
vars:
|
||||
port_attributes: "{{ port_attributes_output.stdout | from_json }}"
|
||||
switch_id: "{{ hostvars[ironic_hypervisor]['ansible_' + bridge].macaddress }}"
|
||||
switch_info: "{{ bridge }}"
|
||||
port_id: >-
|
||||
{{ source_interface
|
||||
| source_to_ovs_link_name(inventory_hostname=ironic_hypervisor) }}
|
||||
command: >-
|
||||
'{{ ironic_virtualenv_path }}/bin/openstack' baremetal port set
|
||||
{{ uuid.stdout }}
|
||||
--physical-network '{{ physnet }}'
|
||||
--local-link-connection switch_id='{{ hostvars[ironic_hypervisor][
|
||||
'ansible_' + bridge
|
||||
].macaddress }}'
|
||||
--local-link-connection switch_id='{{ switch_id }}'
|
||||
--local-link-connection switch_info='{{ bridge }}'
|
||||
--local-link-connection port_id='{{ source_interface
|
||||
| source_to_ovs_link_name(inventory_hostname=ironic_hypervisor) }}'
|
||||
--local-link-connection port_id='{{ port_id }}'
|
||||
when: >-
|
||||
port_attributes.physical_network != physnet or
|
||||
port_attributes.local_link_connection.switch_id != switch_id or
|
||||
port_attributes.local_link_connection.switch_info != switch_info or
|
||||
port_attributes.local_link_connection.port_id != port_id
|
||||
|
|
Loading…
Reference in New Issue