Ansible dictionaries and var_prompt
by prayag_pjs from LinuxQuestions.org on (#53WTP)
I have a dictionary of users in ansible :
Code:---
- hosts: localhost
become: yes
vars:
users:
alice:
name: Alice Appleworth
telephone: 123-456-7890
bob:
name: Bob Bananarama
telephone: 987-654-3210I want to prompt user to enter either alice or bob, something like below :
Code:- hosts: localhost
become: yes
vars_prompt:
- name: users
prompt: enter user
private: no # But here what is the equivalent of below dictionary in vars_prompt -
Code: users:
alice:
name: Alice Appleworth
telephone: 123-456-7890
bob:
name: Bob Bananarama
telephone: 987-654-3210[/CODE]
I want to achieve below with vars_prompt and with_dict
Below is just an example :
When user bob is selected create user on server1 and when alice is selected create user on server2


Code:---
- hosts: localhost
become: yes
vars:
users:
alice:
name: Alice Appleworth
telephone: 123-456-7890
bob:
name: Bob Bananarama
telephone: 987-654-3210I want to prompt user to enter either alice or bob, something like below :
Code:- hosts: localhost
become: yes
vars_prompt:
- name: users
prompt: enter user
private: no # But here what is the equivalent of below dictionary in vars_prompt -
Code: users:
alice:
name: Alice Appleworth
telephone: 123-456-7890
bob:
name: Bob Bananarama
telephone: 987-654-3210[/CODE]
I want to achieve below with vars_prompt and with_dict
Below is just an example :
When user bob is selected create user on server1 and when alice is selected create user on server2