LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-25-2020, 09:33 AM   #1
prayag_pjs
Senior Member
 
Registered: Feb 2008
Location: Pune - India
Distribution: RHEL/Ubuntu/Debian/Fedora/Centos/K3OS
Posts: 1,151
Blog Entries: 4

Rep: Reputation: 147Reputation: 147
Question Ansible dictionaries and var_prompt


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-3210
I 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

Last edited by prayag_pjs; 05-25-2020 at 11:46 AM.
 
  


Reply

Tags
dictionary in ansible, var_prompt, with_dict


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: An Ansible reference guide, CI/CD with Ansible Tower and GitHub, and more news LXer Syndicated Linux News 0 07-16-2019 12:33 PM
LXer: Ansible Guide: Create Ansible Playbook for LEMP Stack LXer Syndicated Linux News 0 04-13-2019 05:03 AM
LXer: Ansible Tutorial: Introduction to simple Ansible commands LXer Syndicated Linux News 0 05-21-2018 10:28 AM
LXer: Ansible Tutorial: Intorduction to simple Ansible commands LXer Syndicated Linux News 0 01-14-2018 05:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration