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

Windows setup module inconsistent with Linux setup module and custom fact_path #57974

Closed
StephenGevers opened this issue Jun 17, 2019 · 6 comments · Fixed by #58887
Closed

Windows setup module inconsistent with Linux setup module and custom fact_path #57974

StephenGevers opened this issue Jun 17, 2019 · 6 comments · Fixed by #58887
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category windows Windows community

Comments

@StephenGevers
Copy link

StephenGevers commented Jun 17, 2019

SUMMARY

We have set up a local facts directory at an alternate location on some of our machines because we do not have root access and cannot create the /etc/facts.d directory. We added the configuration fact_path= in the ansible.cfg file such that it points to the Linux location where we can create our custom facts. On Linux hosts that where the directory doesn't exist, everything works fine. On Windows hosts, the gather facts task fails with "The path does not exist. Typo?"

Note:
setup.ps1 has:

if (-not (Test-Path -Path $factpath)) {
    Fail-Json $result "The path $factpath does not exist. Typo?"
  }

local.py (module_utils/facts/system/local.py) has

        if not fact_path or not os.path.exists(fact_path):
            return local_facts
ISSUE TYPE
  • Bug Report
COMPONENT NAME

lib/modules/windows/setup.ps1

ANSIBLE VERSION
ansible 2.7.10
  config file = /opt/app/workload/ansible/ansible.cfg
  configured module search path = [u'/opt/app/workload/ansible_core/ansible/modules', u'/opt/app/workload/ansible/ansible_cust/modules']
  ansible python module location = /opt/app/workload/ansible_core/ansible
  executable location = /opt/app/workload/ansible_core/bin/ansible
  python version = 2.7.15 (default, May  3 2019, 15:19:10) [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)]
CONFIGURATION
[sg3235@zldv6099 plays]$ ansible-config dump --only-changed
CACHE_PLUGIN(/opt/app/workload/ansible/ansible.cfg) = memory
DEFAULT_ACTION_PLUGIN_PATH(/opt/app/workload/ansible/ansible.cfg) = [u'/opt/app/workload/ansible/ansible_cust/plugins/action', u'/opt/app/workload/ansible_cor
DEFAULT_CALLBACK_PLUGIN_PATH(/opt/app/workload/ansible/ansible.cfg) = [u'/opt/app/workload/ansible/ansible_cust/plugins/callback', u'/opt/app/workload/ansible
DEFAULT_CALLBACK_WHITELIST(/opt/app/workload/ansible/ansible.cfg) = [u'q_callback:service_callback']
DEFAULT_FACT_PATH(/opt/app/workload/ansible/ansible.cfg) = /opt/app/workload/tspace/facts
DEFAULT_FORKS(/opt/app/workload/ansible/ansible.cfg) = 50
DEFAULT_GATHER_TIMEOUT(/opt/app/workload/ansible/ansible.cfg) = 20
DEFAULT_HASH_BEHAVIOUR(/opt/app/workload/ansible/ansible.cfg) = merge
DEFAULT_INVENTORY_PLUGIN_PATH(/opt/app/workload/ansible/ansible.cfg) = [u'/opt/app/workload/ansible/ansible_cust/plugins/inventory', u'/opt/app/workload/ansib
DEFAULT_MODULE_PATH(/opt/app/workload/ansible/ansible.cfg) = [u'/opt/app/workload/ansible_core/ansible/modules', u'/opt/app/workload/ansible/ansible_cust/modu
DEFAULT_MODULE_UTILS_PATH(/opt/app/workload/ansible/ansible.cfg) = [u'/opt/app/workload/ansible/ansible_cust/module_utils', u'/opt/app/workload/ansible_core/a
DEFAULT_ROLES_PATH(/opt/app/workload/ansible/ansible.cfg) = [u'/opt/app/workload/ansible/roles', u'/opt/app/workload/ansible/passwords']
HOST_KEY_CHECKING(/opt/app/workload/ansible/ansible.cfg) = False
INVENTORY_ENABLED(/opt/app/workload/ansible/ansible.cfg) = [u'test_inv', u'host_list', u'script', u'yaml', u'ini', u'auto']

OS / ENVIRONMENT

Linux Redhat Enterprise 6 & 7, Windows 2016

STEPS TO REPRODUCE

Set fact_path in ansible.cfg to any linux path and run a task on a windows host.

EXPECTED RESULTS

Task skips local facts gathering on windows like it does on Linux

ACTUAL RESULTS

Windows Gather Facts fails

TASK [Gathering Facts] *********************************************************
fatal: [*******]: FAILED! => {"ansible_facts": {}, "changed": false, "msg": "The path /opt/app/workload/tspace/facts does not exist. Typo?"}
to retry, use: --limit @/opt/app/workload/ansible/plays/testAsync.retry

@ansibot
Copy link
Contributor

ansibot commented Jun 17, 2019

Files identified in the description:

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
Copy link
Contributor

ansibot commented Jun 17, 2019

@ansibot ansibot added affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. system System category labels Jun 17, 2019
@ansibot
Copy link
Contributor

ansibot commented Jul 8, 2019

Files identified in the description:

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 support:core This issue/PR relates to code supported by the Ansible Engineering Team. and removed support:community This issue/PR relates to code supported by the Ansible community. labels Jul 8, 2019
@StephenGevers
Copy link
Author

!component=lib/ansible/modules/windows/setup.ps1

@ansibot
Copy link
Contributor

ansibot commented Jul 9, 2019

Files identified in the description:

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
Copy link
Contributor

ansibot commented Jul 9, 2019

@ansibot ansibot added the windows Windows community label Jul 9, 2019
@bcoca bcoca removed the needs_triage Needs a first human triage before being processed. label Jul 11, 2019
@samdoran samdoran added the has_pr This issue has an associated PR. label Jul 11, 2019
@ansible ansible locked and limited conversation to collaborators Dec 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.7 This issue/PR affects Ansible v2.7 bug This issue/PR relates to a bug. has_pr This issue has an associated PR. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category windows Windows community
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants