tripleo-ansible/tripleo_ansible/roles/octavia_controller_config/tasks/netport.yml
Kevin Carter 67ce344e30 Rename all roles that have a hyphen
All roles that have a hyphen in them need to be renamed to use an
underscore. This change creates a symlink to all roles using their
original name which will ensure we maintain compatibility with
the rest of the TripleO stack. This is being done because roles with
hyphens are no longer valid within collections.

A temp PBR update has been made to accomodate all of the symlinks to
the legacy role names.

[0] https://docs.ansible.com/ansible/devel/dev_guide/developing_collections.html#roles-directory

Change-Id: Id00a3670351990e5489a297c4c7200f8c05af096
Signed-off-by: Kevin Carter <kecarter@redhat.com>
2020-01-21 20:42:40 -06:00

79 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 }} \
--no-security-groups \
--port-security-enabled=False \
--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"