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, 2020 in Ansible by akhtar
• 38,210 points
1,304 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, 2020 by MD
• 95,300 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
• 7,320 points
3,122 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,680 points
379 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
2,297 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
188 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
1,255 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, 2020 in Ansible by MD
• 95,300 points
165 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, 2020 in Ansible by MD
• 95,300 points
7,348 views