78 lines
2.7 KiB
YAML
78 lines
2.7 KiB
YAML
---
|
|
- name: create management port
|
|
shell: |-
|
|
set -o pipefail
|
|
port_id="$(openstack port show octavia-health-manager-{{ node_hostname }}-listen-port -f value -c id 2> /dev/null)"
|
|
if [[ -z "${port_id}" ]]; then
|
|
neutron port-create {{ lb_mgmt_net_name }} --binding:host_id={{ node_hostname }} \
|
|
--security-group {{ lb_health_mgr_sec_grp_name }} \
|
|
--device-owner Octavia:health-mgr \
|
|
--name octavia-health-manager-{{ node_hostname }}-listen-port \
|
|
-f value \
|
|
-c id
|
|
fi
|
|
register: out_mgmt_port
|
|
changed_when: (out_mgmt_port.stdout | length) > 0
|
|
notify:
|
|
- octavia config updated
|
|
|
|
- name: getting management port
|
|
shell: |
|
|
openstack port show octavia-health-manager-{{ node_hostname }}-listen-port -f value -c id
|
|
register: out_mgmt_port_id
|
|
changed_when: false
|
|
|
|
- name: setting fact for management network controller port ID
|
|
set_fact:
|
|
mgmt_port_id: "{{ out_mgmt_port_id.stdout }}"
|
|
|
|
- name: get management port mac
|
|
shell: |
|
|
openstack port show {{ mgmt_port_id }} -f value -c mac_address
|
|
register: out_mgmt_port_mac
|
|
changed_when: false
|
|
|
|
- name: setting fact for management network controller port MAC
|
|
set_fact:
|
|
mgmt_port_mac: "{{ out_mgmt_port_mac.stdout }}"
|
|
|
|
- name: get fixed ip info
|
|
shell: |
|
|
openstack port show {{ mgmt_port_id }} -f json -c fixed_ips
|
|
register: mgmt_port_fixed_ip_out
|
|
|
|
- name: get management port detail result
|
|
set_fact:
|
|
mgmt_port_details: "{{ mgmt_port_fixed_ip_out.stdout }}"
|
|
|
|
- name: parse management port details
|
|
set_fact:
|
|
mgmt_port_ip: "{{ mgmt_port_details | json_query('fixed_ips[*].ip_address') | first }}"
|
|
mgmt_port_subnet: "{{ mgmt_port_details | json_query('fixed_ips[*].subnet_id') | first }}"
|
|
|
|
- name: get management port net mask
|
|
shell: |
|
|
openstack subnet show {{ mgmt_port_subnet }} -f value -c cidr 2> /dev/null
|
|
register: out_mgmt_subnet_cidr
|
|
|
|
- name: setting fact for management subnet cidr
|
|
set_fact:
|
|
mgmt_subnet_cidr: "{{ out_mgmt_subnet_cidr.stdout }}"
|
|
|
|
- name: setting fact for management network netmask
|
|
set_fact:
|
|
mgmt_port_netmask: "{{ mgmt_subnet_cidr | ipaddr('netmask') }}"
|
|
|
|
- name: get MTU for management port
|
|
shell: |
|
|
openstack network show {{ lb_mgmt_net_name }} -f value -c mtu
|
|
register: out_mgmt_port_mtu
|
|
|
|
- name: setting fact for management port MTU
|
|
set_fact:
|
|
mgmt_port_mtu: "{{ out_mgmt_port_mtu.stdout }}"
|
|
|
|
- name: creating fact for management network health manager controller IP
|
|
set_fact:
|
|
o_hm_ip: "{{ mgmt_port_ip }}:5555"
|