Forum Discussion
REST - Any way to add multiple pool members in the same request in BIG-IP 13.0.0 Build 2.0.1671 Hotfix HF2
I referred the following question, https://devcentral.f5.com/questions/rest-any-way-to-add-multiple-pool-members-in-the-same-request. Is the feature implemented in version [BIG-IP 13.0.0 Build 2.0.1671 Hotfix HF2]
- Satoshi_Toyosa1Ret. Employee
To replace all the existing pool members in the pool
with one of the existing nodes (pl
here), run the following:CentOS-vmnet80
curl -sku admin: https:///mgmt/tm/ltm/pool/pl \ -X PATCH -H "Content-type: application/json" \ -d '{ "membersReference":{ "items":[ { "name":"CentOS-vmnet3:80","partition":"Common" } ] } }'
The method also works for a pool with no member. Similarly, to replace all with new IP addresses:
curl -sku admin: https:///mgmt/tm/ltm/pool/pl \ -X PATCH -H "Content-type: application/json" \ -d '{ "membersReference":{ "items":[ {"name":"10.10.10.1:80"}, {"name":"10.10.10.2:80"} ] } }'
They work on all versions (tested on 12.1.3, 13.0.0 and 13.1.0).
Note that the iControl REST calls above overwrite the existing pool members (irrespective of BIG-IP versions): i.e., they are equivalent to
. No 'add' command is supported.tmsh modify ltm pool pl members replace-all-with { ... }
If you want to do 'add', you need to first get the list of pool members, modify the list with additional member(s), and put that back to the pool. The following command will get you the list of the pool
:pl
curl -sku admin: https:///mgmt/tm/ltm/pool/pl/members
- Satoshi_Toyosa1Ret. Employee
iControl REST does not support pool member 'add' (
) in any BIG-IP versions (to my knowledge). Load all the members, modify the list (add, delete, etc), and put it back.tmsh ltm pool members add {}
- Satoshi_Toyosa1Ret. Employee
I was wrong. You can
oradd
a member to a pool.delete
Add an existing node
to the poolCentOS:80
. Note that you need to use the port number not protocol name (e.g., http).pl
tmsh modify ltm pool pl members add { CentOS:80 } curl -sku admin: https:///mgmt/tm/ltm/pool/pl/members \ -X POST -H "Content-type: application/json" \ -d '{"name":"CentOS:80", "partition":"Common"}'
You can also add a member by specifying the IP address. If the node with that name does not exist, BIG-IP creates one for you (just like the equivalent tmsh command).
tmsh modify ltm pool pl members add { 10.0.0.2:80 } curl -sku admin: https:///mgmt/tm/ltm/pool/pl/members \ -X POST -H "Content-type: application/json" \ -d '{"name":"10.0.0.2:80", "partition":"Common"}'
Delete an existing pool member
from the poolCentOS:80
. Note that you need to explicitly specify the partition (in this example,pl
๐Common
tmsh modify ltm pool pl members delete { CentOS:80 } curl -sku admin: https:///mgmt/tm/ltm/pool/pl/members/~Common~CentOS:80 -X DELETE
- StephanManthey
Nacreous
Thanks Satoshi San for the thorough explanation (+1).
I would like to add a equivalent for
modify ltm pool <pool_name> members none
By using PATCH with an empty list all pool members can be deleted, i.e.:
curl -svk -u admin: -X PATCH -H 'Content-Type: application/json' -d '{"members": []}' https://localhost/mgmt/tm/ltm/pool/pool_test_app001
Instead of using the "membersReference":{"items":[{ "name":"<node-name>:<port>","partition":"<partition-name>" }]}
syntax you may use the following one as well. It includes some additional parameters, i.e. (tested in TMOS v14.1.2):
curl -svk -u admin: -X PATCH -H 'Content-Type: application/json' -d '{"members": [ {"name": "node_c:80", "address": "10.131.131.103", "session": "user-disabled"}, {"name": "node_d:80", "address": "10.131.131.104", "session": "user-disabled"}]}' https://localhost/mgmt/tm/ltm/pool/pool_test_app001
Ideally we would have the ability to POST, PUT or PATCH on https://<hostname>/mgmt/tm/ltm/pool/<pool-name>/members level with lists of items (i.e. to add multiple pool members to existing ones in a single step). This can be done already in tmsh. Via API it seems like we have to add multiple members one by one.
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com