Forum Discussion
Andy_McGrath
Oct 17, 2018Cumulonimbus
I 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.