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

Meta: Refresh_Inventory does not respect When conditions and will always run. #38074

Closed
ghost opened this issue Mar 29, 2018 · 2 comments
Closed
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@ghost
Copy link

ghost commented Mar 29, 2018

ISSUE TYPE
  • Bug Report
COMPONENT NAME

meta: refresh_inventory

ANSIBLE VERSION
2.4.3

CONFIGURATION
OS / ENVIRONMENT

Running from Ubuntu 16.04 control machine talking to AWS.

SUMMARY

The meta: refresh_inventory does not respect a when condition and will always run regardless of the when condition.

STEPS TO REPRODUCE
 - name: test
    debug: msg="yes"
    when: web|changed

  - name: Refresh Inventory
    meta: refresh_inventory
    when: web|changed

EXPECTED RESULTS

For the refresh_inventory to respect the when condition and only run when it's required.

ACTUAL RESULTS

TASK [test] *************************************************************************task path: /mnt/c/Users/sarli_q5dr3em/projects/ansible-ptvgui/playbooks/aws_selenium_ec2appservers_lin.yml:55
skipping: [localhost] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}
setting up inventory plugins
Set default localhost to localhost
Parsed /mnt/c/Users/sarli_q5dr3em/projects/ansible-ptvgui/inventory/devaws/base inventory source with ini plugin
Parsed /mnt/c/Users/sarli_q5dr3em/projects/ansible-ptvgui/inventory/devaws/ec2.py inventory source with script plugin
META: inventory successfully refreshed
META: ran handlers
META: ran handlers
@ansibot
Copy link
Contributor

ansibot commented Mar 29, 2018

Files identified in the description:
None

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. 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 Mar 29, 2018
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Mar 29, 2018
@bcoca
Copy link
Member

bcoca commented Aug 23, 2019

Possible Misunderstanding

Hi!

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

This has been documented as the 'when' would be conditional to a specific host and the refresh is global. This is true for some of the 'meta' actions as they trigger changes into the engine itself, please see the docs for more details. https://docs.ansible.com/ansible/latest/modules/meta_module.html

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 23, 2019
@ansible ansible locked and limited conversation to collaborators Sep 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. 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