PG0581
Aug 29, 2018Cirrus
Ansible - Looping vars_prompt question to create LTM pool
I'm trying to create a playbook to create a pool, and the variables of the pool configuration are provided by the user.
I have it working configuring just one pool member, but in most cases, there are multiple pool members. Any ideas on how I could loop the below question, and exit the loop once the user has entered all of the pool members?
- name: "pool_member"
prompt: "Enter the pool member IP and port [enter as IP:Port]"
private: no
- name: "pool_address"
prompt: "Enter the pool member address"
Also, once all of the user's input has been collected, how would you then pass it into the implementation? Here's what I have so far for that section:
- name: Implementation
bigip_command:
server: "{{ inventory_hostname }}"
user: "{{ remote_username }}"
password: "{{ remote_passwd }}"
commands:
- "tmsh create ltm pool {{ pool_name }} { load-balancing-mode {{ pool_lb_mode }} members add { {{ pool_member }} { address {{ pool_address }} } } monitor {{ pool_monitor }} }"
validate_certs: no
delegate_to: localhost