Forum Discussion
Samir_Jha_52506
Noctilucent
Sep 22, 2018VIP setup in Ansible
Hi Expert,
Can any one help me to setup VIP, Pool in ansible. How do i create 3 node in pool via ansible.
Thanks
- Simon_Blakely
Employee
- Lee_Sutcliffe
Nacreous
This is an example of how to set up a pool and add members using the loop method and Ansible environment variables.
F5 host needs to be defined in an inventory file 'inventory/hosts'
[f5] 192.168.1.1
Playbook:
--- - name: Setup hosts: f5 connection: local gather_facts: True vars: f5Provider: server: "{{inventory_hostname}}" user: "admin" password: "admin" validate_certs: no transport: rest nodelist: - {name: 'test01', address: '8.8.8.8', priority_group: 1, state: 'present'} - {name: 'test02', address: '8.8.4.4', priority_group: 1, state: 'present'} environment: F5_SERVER: "{{ inventory_hostname }}" F5_USER: "{{ f5Provider.user }}" F5_PASSWORD: "{{ f5Provider.password }}" F5_VALIDATE_CERTS: "{{ f5Provider.validate_certs }}" F5_SERVER_PORT: "{{ f5Provider.server_port }}" tasks: - name: Add pool 'test_pool' bigip_pool: lb_method: least-connections-member name: test_pool monitor_type: single monitors: - /Common/gateway_icmp priority_group_activation: 0 delegate_to: localhost notify: Save configuration - name: Add nodes bigip_node: address: "{{ item.address }}" name: "{{ item.name }}" loop: "{{ nodelist }}" delegate_to: localhost notify: Save configuration - name: Add pool members to Pool 'test_pool' bigip_pool_member: pool: test_pool address: "{{ item.address }}" name: "{{ item.name }}" port: 53 priority_group: "{{ item.priority_group }}" state: "{{ item.state }}" loop: "{{ nodelist }}" delegate_to: localhost notify: Save configuration
- youssef1
Cumulonimbus
Hi Samir,
Waiting my response did you check:
You have complete documentation and several examples.
regards
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