|
| 1 | +--- |
| 2 | + |
| 3 | +- name: Get network info |
| 4 | + openstack.cloud.networks_info: |
| 5 | + name: "{{ load_balancer_network_name }}" |
| 6 | + register: existing_networks |
| 7 | + run_one: true |
| 8 | + |
| 9 | +- name: Create network if not exists |
| 10 | + openstack.cloud.network: |
| 11 | + name: "{{ load_balancer_network_name }}" |
| 12 | + provider_network_type: "{{ provider_network_type }}" |
| 13 | + state: present |
| 14 | + when: existing_networks | length == 0 |
| 15 | + run_one: true |
| 16 | + |
| 17 | +- name: Create a new subnet in neutron |
| 18 | + openstack.cloud.subnet: |
| 19 | + network_name: "{{ load_balancer_network_name }}" |
| 20 | + name: "{{ load_balancer_subnet_name }}" |
| 21 | + cidr: "{{ load_balancer_subnet }}" |
| 22 | + allocation_pool_start: "{{ load_balancer_subnet_start }}" |
| 23 | + allocation_pool_end: "{{ load_balancer_subnet_end }}" |
| 24 | + state: present |
| 25 | + run_one: true |
| 26 | + |
| 27 | +- name: Create a security group |
| 28 | + openstack.cloud.security_group: |
| 29 | + name: lb-mgmt-sec-grp |
| 30 | + state: present |
| 31 | + description: security group for octavia load balancers |
| 32 | + run_one: true |
| 33 | + |
| 34 | +- name: Create a security group rule |
| 35 | + openstack.cloud.security_group_rule: |
| 36 | + security_group: lb-mgmt-sec-grp |
| 37 | + protocol: icmp |
| 38 | + remote_ip_prefix: 0.0.0.0/0 |
| 39 | + run_one: true |
| 40 | + |
| 41 | +- name: Create a security group rule |
| 42 | + openstack.cloud.security_group_rule: |
| 43 | + security_group: lb-mgmt-sec-grp |
| 44 | + protocol: tcp |
| 45 | + port_range_min: 22 |
| 46 | + port_range_max: 22 |
| 47 | + remote_ip_prefix: 0.0.0.0/0 |
| 48 | + run_one: true |
| 49 | + |
| 50 | +- name: Create a security group rule |
| 51 | + openstack.cloud.security_group_rule: |
| 52 | + security_group: lb-mgmt-sec-grp |
| 53 | + protocol: tcp |
| 54 | + port_range_min: 9443 |
| 55 | + port_range_max: 9443 |
| 56 | + remote_ip_prefix: 0.0.0.0/0 |
| 57 | + run_one: true |
| 58 | + |
| 59 | +- name: Create a security group for octavia health manager |
| 60 | + openstack.cloud.security_group: |
| 61 | + name: lb-health-mgr-sec-grp |
| 62 | + state: present |
| 63 | + description: security group for octavia health manager |
| 64 | + run_one: true |
| 65 | + |
| 66 | +- name: Create a health group security rules |
| 67 | + openstack.cloud.security_group_rule: |
| 68 | + security_group: lb-health-mgr-sec-grp |
| 69 | + protocol: udp |
| 70 | + port_range_min: 5555 |
| 71 | + port_range_max: 5555 |
| 72 | + remote_ip_prefix: 0.0.0.0/0 |
| 73 | + run_one: true |
| 74 | + |
| 75 | +# We want to create the ports on the ovn nodes. In Understack, we can |
| 76 | +# identify those as the nodes having the ansible host var setting |
| 77 | +# `ovs_enabled=true`. |
| 78 | +- name: Create ports |
| 79 | + openstack.cloud.port: |
| 80 | + name: "octavia-health-manager-port-{{ item }}" |
| 81 | + network: lb-mgmt-net |
| 82 | + security_groups: lb-health-mgr-sec-grp |
| 83 | + device_owner: "Octavia:health-mgr" |
| 84 | + binding_host_id: "{{ item }}" |
| 85 | + state: present |
| 86 | + with_items: "{{ groups['all'] |
| 87 | + | map('extract', hostvars) |
| 88 | + | selectattr('ovs_enabled', 'defined') |
| 89 | + | selectattr('ovs_enabled', 'equalto', true) |
| 90 | + | map(attribute='inventory_hostname') |
| 91 | + | list }}" |
0 commit comments