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

Add MacOS X dscl support to getent module #38339

Open
rleigh-codelibre opened this issue Apr 5, 2018 · 3 comments

Comments

Projects
None yet
4 participants
@rleigh-codelibre
Copy link

commented Apr 5, 2018

ISSUE TYPE

Bug Report

  • Feature Idea
COMPONENT NAME

getent

ANSIBLE VERSION
ansible 2.5.0
  config file = /home/rleigh/.ansible.cfg
  configured module search path = [u'/home/rleigh/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/rleigh/venv/ansible/local/lib/python2.7/site-packages/ansible
  executable location = /home/rleigh/venv/ansible/bin/ansible
  python version = 2.7.14+ (default, Apr  2 2018, 04:16:25) [GCC 7.3.0]
CONFIGURATION
ALLOW_WORLD_READABLE_TMPFILES(/home/rleigh/.ansible.cfg) = True
DEFAULT_HOST_LIST(/home/rleigh/.ansible.cfg) = [u'/home/rleigh/code/management_tools/ansible/inventory']
DEFAULT_ROLES_PATH(/home/rleigh/.ansible.cfg) = [u'/home/rleigh/code/infrastructure/ansible/ci-playbooks/roles']
OS / ENVIRONMENT

Ubuntu 18.04 / amd64.

SUMMARY

The getent module does not work on MacOS X. It relies upon the getent command, rather than using the OS-specific tool. On MacOS X, this would likely be the dscl command.

STEPS TO REPRODUCE

Run the following on a MacOS X node:

ansible -m getent -a 'database=passwd key=<user>' <host>
EXPECTED RESULTS

I expected the database information would be queried and returned.

ACTUAL RESULTS
% ansible -m getent -a 'database=passwd key=ci-admin' <host>
<host> | FAILED! => {
    "changed": false, 
    "msg": "Failed to find required executable getent in paths: /usr/bin:/bin:/usr/sbin:/sbin"
}
@ansibot

This comment has been minimized.

Copy link
Contributor

commented Apr 5, 2018

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

This comment has been minimized.

Copy link
Contributor

commented Apr 5, 2018

@bcoca bcoca added feature and removed bug needs_triage labels Apr 5, 2018

@bcoca bcoca changed the title getent module broken on MacOS X Add MacOS X support to getent module Apr 5, 2018

@bcoca bcoca changed the title Add MacOS X support to getent module Add MacOS X dscl support to getent module Apr 5, 2018

@ansibot ansibot added the system label Feb 17, 2019

drybjed added a commit to drybjed/debops that referenced this issue May 23, 2019

[debops.system_users] Custom local getent script
The 'getent' Ansible module does not work correctly on Apple macOS,
therefore the 'debops.system_users' role will use a custom Python script
to get the current Ansible user information from the Ansible Controller.

Ref: ansible/ansible#38339

drybjed added a commit to debops/debops that referenced this issue May 23, 2019

[debops.system_users] Custom local getent script
The 'getent' Ansible module does not work correctly on Apple macOS,
therefore the 'debops.system_users' role will use a custom Python script
to get the current Ansible user information from the Ansible Controller.

Ref: ansible/ansible#38339
@wordtracker

This comment has been minimized.

Copy link

commented May 23, 2019

As per "custom local getent script" above, why don't we keep it machine agnostic by using Python and the pwd module? Simplez.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.