Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vars_prompt fires even if no hosts matched for a play #28408

Closed
akamac opened this issue Aug 18, 2017 · 2 comments
Closed

vars_prompt fires even if no hosts matched for a play #28408

akamac opened this issue Aug 18, 2017 · 2 comments
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. c:cli/playbook support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@akamac
Copy link

akamac commented Aug 18, 2017

ISSUE TYPE
  • Bug Report
COMPONENT NAME

playbook, vars_prompt

ANSIBLE VERSION

ansible 2.3.1.0
config file = /home/amiasoedov/ansible/playbooks/linux/ansible.cfg
configured module search path = Default w/o overrides
python version = 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609]

CONFIGURATION
OS / ENVIRONMENT

N/A

SUMMARY
STEPS TO REPRODUCE
- hosts: no_hosts
  vars_prompt:
    - name: varname
      prompt: fired
EXPECTED RESULTS

the play is skipped with no var prompts

ACTUAL RESULTS

I'm asked for input

@ansibot ansibot added affects_2.3 This issue/PR affects Ansible v2.3 bug_report c:cli/playbook needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Aug 18, 2017
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Aug 21, 2017
@bcoca
Copy link
Member

bcoca commented Aug 21, 2017

Possible Misunderstanding

Hi!

Thanks very much for your submission to Ansible. It sincerely means a lot to us.

We believe the ticket you have filed is being somewhat misunderstood, as one thing works a little differently than stated.

This is on purpose, as you are allowed to use the vars_prompt to set a variable used in hosts:, for example:

- hosts: "{{ myhost|default('localhost') }}"
  vars_prompt:
    - name: myhost
  gather_facts: False
  tasks:
     - debug: var=inventory_hostname

In the future, this might be a topic more well suited for the user list, which you can also post here if you'd like some more help with the above.

Thank you once again for this and your interest in Ansible!

@bcoca bcoca closed this as completed Aug 21, 2017
@akamac
Copy link
Author

akamac commented Aug 24, 2017

Thanks for the explanation, @bcoca

@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.3 This issue/PR affects Ansible v2.3 bug This issue/PR relates to a bug. c:cli/playbook support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

No branches or pull requests

3 participants