i need to create for an existing octavia loadbalancer multiple pools, listeners and members. I do not want to do that for several envs manually and also not over the GUI in Openstack. Best way would be to do it over the openstack cli.
The 3 manual commands for this example is (existing loadbalancer my-lb01, port 50000):
openstack loadbalancer pool create --lb-algorithm ROUND_ROBIN --loadbalancer my-lb01 --name my-tcp-pool_50000 --protocol TCP
openstack loadbalancer listener create --name my-tcp-listener_50000 --protocol tcp --protocol-port 50000 my-lb01 --default-pool my-tcp-pool_50000
openstack loadbalancer member create --name my-tcp-member01 --address 172.40.41.100 --protocol-port 50000 --subnet-id 56789-12345-09876-xxx
openstack loadbalancer member create --name my-tcp-member02 --address 172.40.41.101 --protocol-port 50000 --subnet-id 56789-12345-09876-xxx
openstack loadbalancer member create --name my-tcp-member03 --address 172.40.41.102 --protocol-port 50000 --subnet-id 56789-12345-09876-xxx
How would you do that with an script if i want to create ports from 50000-50100? I know that pool ranges cannot be used in Opnestack UI when creating pool/listeners. Therefore i need to do that manually but i dont want to execute the commands above 100times.
The following values will change_
-
pool name: the first pool will be my-tcp-pool_50000, the next one my-tcp-pool_50001 etc.
-
listener name: the first listener is my-tcp-listener_50000, the next one my-tcp-listener_50001 etc.
-
listener protocol port: will always be the port which is also used for the pool/listener names: 50000, 50001 etc.
-
default pool: is always the pool which is created for the port: my-tcp-pool_50000, my-tcp-pool_50001 etc.
-
-
Member name: same procedure as above: my-tcp-member01/02/03
-
address: Each stage has different member IPs. So if i execute the script in STAGE01 the members IPs are those ones above, for STAGE02 only the 41 will be changed to 42. For Stage03 it will be 43 etc.
-
member protocol port is always the one used for this pools/listener
-
subnet id is for each stage different. So if i create pools/listeners in STAGE01 for the port range 50000-50100 it will be subnet id: 56789-12345-09876-001, for STAGE02 is the subnet id 56789-12345-09876-02 etc.9-12345-09876-xxx
-
Maybe anyone of you has an example how you do that? Any hints and tipps are welcome.
Thanks in advance
The openstack cli commands has been executed for a port range of 50000-500010. Means all thos commands executed for the ports one by one.
1