Forum Discussion
adams8907_36321
Oct 17, 2018Historic F5 Account
How to add nodes in bulk using RestAPI?
I am trying to generate add multiple nodes using RestAPI, but I have not been able.
Wondering if this is possible, if so, can you give me an example?
Andy_McGrath
Cumulonimbus
Oct 17, 2018I don't think you can do create multiple nodes from the iControl REST API within a single request but you could script it using something like Python and the F5-SDK or with the use of Ansible.
Example Ansible playbook below, you would need to have the F5 device listed in the Ansible
hosts file and named f5.
---
- name: Run tasks on Active LTM
hosts: f5
connection: local
gather_facts: True
vars:
f5Provider:
server: "{{inventory_hostname}}"
server_port: 443
user: admin
password: admin
validate_certs: no
transport: rest
nodelist:
- {name: 'test01', address: '10.0.0.1'}
- {name: 'test02', address: '10.0.0.2'}
- {name: 'test03', address: '10.0.0.3'}
- {name: 'test04', address: '10.0.0.4'}
tasks:
- name: Add nodes
bigip_node:
provider: "{{f5Provider}}"
partition: test
address: "{{ item.address }}"
name: "{{ item.name }}"
loop: "{{nodelist}}"
delegate_to: localhost
notify: Save configuration
handlers:
- name: Save configuration
bigip_config:
save: yes
delegate_to: localhost
NOTE: this is create four nodes in the
test partition and then triggering a configuration save.Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
