Prompt option listing all the servers in inventory

21 views
Skip to first unread message

Veera

unread,
Nov 14, 2022, 4:40:07 PM11/14/22
to Ansible Project
Hi ,

I am trying to confirm the hosts which are selected for the  execution  with the prompt option.  However I am prompted with all the servers in my inventory .(not sure how it pulls , may be ansible_play_batch)

Help me on what i am missing?

- name: Playbook to update the package in the given list of servers
  hosts: server1
  gather_facts: no

  vars_files:
    - vars/postcheck_vars.yml


  vars_prompt:
     - name: confirm  the below list of servers are part of patching for the given wave
       prompt: >-
         You have selected  {{ ansible_play_batch }} . Do you want to continue? Press y

  tasks:
    - name: Waiting for confirmation
      fail:
      when: confirm.lower() != 'y'




If i replace server1  with  group1 , all the servers in the group has to be listed(prompted) before the execution of the play . 

Reply all
Reply to author
Forward
0 new messages