Adding multiple ips to an openstack VMs either existing or new VM its horrible like am getting request to add more than 200 ips to an instance. How do i write a script or playbook ?
starting IP from 192.168.0.50 to 192.168.0.150
How i add multiple ips by manually here its
$ source Project_admin
$ openstack network list | grep Test12
| ID | Name | Subnet | ID |
| kshd332sjkh-kjhj-sdsds-sdsdsds |Test12 | (192.168.0.0/24) | derere43e-erere-drerer-erererer |
$ openstack port list | grep 192.168.0.49 # (it show the First NIC port information and Port ID of an Single VM its a primary NIC)
Here my first NIC port id is 3k3j43434-skdjk-erere-2323
#openstck port set --fixed-ip subnet=**derere43e-erere-drerer-erererer**,ip-address=192.168.0.50 --fixed-ip subnet-derere43e-erere-drerer-erererer,ip-address=192.168.0.51 --fixed-ip subnet-derere43e-erere-drerer-erererer,ip-address=192.168.0.52 --fixed-ip subnet-derere43e-erere-drerer-erererer,ip-address=192.168.0.53 **3k3j43434-skdjk-erere-2323** **(myfirst-nic-port-id of 192.168.0.49)**
How do i perform this using script/python or playbook using os_port .is any way to achieve these would be more helpful my rotional task
What OS are you on? If you have a shell like Bash at your disposal this would work for your specific example:
for octet in {50..150};do
openstack port set --fixed-ip subnet-derere43e-erere-drerer-erererer,ip-address=192.168.0.$octet
done