How to take user input in Ansible?

0 votes

Hi Guys,

I have one ansible-playbook in my controller node. I want to enable user input in this playbook. So that I can pass input at the run time. How can I do that?

Aug 10 in Ansible by akhtar
• 25,030 points
60 views

1 answer to this question.

0 votes

Hi@akhtar,

To ask for user input, we will use the vars_prompt section in our playbook. You can follow the below playbook for better understanding.

- hosts: server
  gather_facts: no
  vars_prompt:
    - name: "Install"
      prompt: "Which software you want to install"
  tasks:
  - name: Install httpd module
    package:
      name: "{{ Install }}"
      state: present
answered Aug 10 by MD
• 56,480 points

Related Questions In Ansible

0 votes
1 answer

How to regex replace nested values in Ansible

I'm not aware of any built-in method ...READ MORE

answered Jun 16, 2018 in Ansible by shubham
• 6,910 points
2,224 views
0 votes
1 answer

devops , how to create user using ansible playbook

root doesn't need a password to switch ...READ MORE

answered Jul 16, 2018 in Ansible by Kalgi
• 2,620 points
212 views
0 votes
1 answer

How to configure fact caching in Ansible?

There are two cache plugins: redis and jsonfile. To ...READ MORE

answered Jan 24, 2019 in Ansible by Kennedy
1,610 views
0 votes
1 answer

How do I handle different machines needing different user accounts or ports to log in with?

Setting inventory variables in the inventory file ...READ MORE

answered Jan 30, 2019 in Ansible by Ansi
81 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
677 views
+2 votes
1 answer
0 votes
1 answer

How to install Ansible in Linux system?

Hi@akhtar, To install Ansible in your Linux system, ...READ MORE

answered Jul 27 in Ansible by MD
• 56,480 points
68 views
0 votes
1 answer

How to list down all the hosts in Ansible?

Hi@akhtar, You can use the option --list-hosts. It will ...READ MORE

answered Jul 28 in Ansible by MD
• 56,480 points
249 views