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

restrict_facts_namespace is not respected #31330

Closed
nkakouros opened this issue Oct 4, 2017 · 2 comments
Closed

restrict_facts_namespace is not respected #31330

nkakouros opened this issue Oct 4, 2017 · 2 comments
Labels
affects_2.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@nkakouros
Copy link
Contributor

nkakouros commented Oct 4, 2017

ISSUE TYPE
  • Bug Report
ANSIBLE VERSION
ansible 2.5.0
  config file = /home/nikos/Ethical_Hacking/EN2720/ansible.cfg
  configured module search path = [u'/home/nikos/Ethical_Hacking/EN2720/ansible/library']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.14 (default, Sep 20 2017, 01:25:59) [GCC 7.2.0]
CONFIGURATION

only defaults

OS / ENVIRONMENT

Running Arch Linux, provisioning Ubuntu 16.04.

SUMMARY

ansible_facts is undefined even when restrict_facts_namespace is set to True.

STEPS TO REPRODUCE
  1. Create a playbook.yml with the following contents:
 - hosts: localhost
   tasks:
   - debug: var=ansible_facts
  1. Create an ansible.cfg with the following contents:
[defaults]
restrict_facts_namespace = True
  1. Run ansible-playbook playbook.yml -vvv
EXPECTED RESULTS

ansible_facts should be printed containing all facts gathered on the localhost.

ACTUAL RESULTS

Ansible fails with:

The full traceback is:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 123, in run
    res = self._execute()
  File "/usr/lib/python2.7/site-packages/ansible/executor/task_executor.py", line 562, in _execute
    vars_copy.update(result['ansible_facts'])
ValueError: dictionary update sequence element #0 has length 1; 2 is required

fatal: [localhost]: FAILED! => {
    "msg": "Unexpected failure during module execution.",
    "stdout": ""
}

Changing the debug task to debug: msg="{{ansible_facts}}" results in:

fatal: [localhost]: FAILED! => {
    "msg": "The task includes an option with an undefined variable. The error was: 'ansible_facts' is undefined\n\nThe error appears to have been in '/home/nikos/q/playbook.yml': line 3, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n  tasks:\n  - debug: msg=\"{{ansible_facts}}\"\n    ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes.  Always quote template expression brackets when they\nstart a value. For instance:\n\n    with_items:\n      - {{ foo }}\n\nShould be written as:\n\n    with_items:\n      - \"{{ foo }}\"\n"
}

Setting restrict_facts_namespace to False changes nothing.

@ansibot
Copy link
Contributor

ansibot commented Oct 4, 2017

@tterranigma Greetings! Thanks for taking the time to open this issue. In order for the community to handle your issue effectively, we need a bit more information.

Here are the items we could not find in your description:

  • component name

Please set the description of this issue with this template:
https://raw.githubusercontent.com/ansible/ansible/devel/.github/ISSUE_TEMPLATE.md

click here for bot help

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 bug_report needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. 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 Oct 4, 2017
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Oct 5, 2017
@bcoca
Copy link
Member

bcoca commented Oct 5, 2017

This is not currently a feature, it was planned but removed from 2.4 and requeued for possible inclusion in 2.5

I updated the example/ansible.cfg to remove the commented out entry to avoid future confusion

closed via d2c7539

@bcoca bcoca closed this as completed Oct 5, 2017
bcoca added a commit that referenced this issue Oct 5, 2017
@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.5 This issue/PR affects Ansible v2.5 bug This issue/PR relates to a bug. needs_info This issue requires further information. Please answer any outstanding questions. needs_template This issue/PR has an incomplete description. Please fill in the proposed template correctly. 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