{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/23944","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/23944/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/23944/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/23944/events","html_url":"https://github.com/ansible/ansible/issues/23944","id":223993100,"node_id":"MDU6SXNzdWUyMjM5OTMxMDA=","number":23944,"title":"user module doesnt work on busybox based distros without shadow-utils","user":{"login":"ju2wheels","id":396211,"node_id":"MDQ6VXNlcjM5NjIxMQ==","avatar_url":"https://avatars0.githubusercontent.com/u/396211?v=4","gravatar_id":"","url":"https://api.github.com/users/ju2wheels","html_url":"https://github.com/ju2wheels","followers_url":"https://api.github.com/users/ju2wheels/followers","following_url":"https://api.github.com/users/ju2wheels/following{/other_user}","gists_url":"https://api.github.com/users/ju2wheels/gists{/gist_id}","starred_url":"https://api.github.com/users/ju2wheels/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ju2wheels/subscriptions","organizations_url":"https://api.github.com/users/ju2wheels/orgs","repos_url":"https://api.github.com/users/ju2wheels/repos","events_url":"https://api.github.com/users/ju2wheels/events{/privacy}","received_events_url":"https://api.github.com/users/ju2wheels/received_events","type":"User","site_admin":false},"labels":[{"id":454885231,"node_id":"MDU6TGFiZWw0NTQ4ODUyMzE=","url":"https://api.github.com/repos/ansible/ansible/labels/affects_2.3","name":"affects_2.3","color":"5319e7","default":false},{"id":852590921,"node_id":"MDU6TGFiZWw4NTI1OTA5MjE=","url":"https://api.github.com/repos/ansible/ansible/labels/feature","name":"feature","color":"006b75","default":false},{"id":496359346,"node_id":"MDU6TGFiZWw0OTYzNTkzNDY=","url":"https://api.github.com/repos/ansible/ansible/labels/module","name":"module","color":"1d76db","default":false},{"id":636352796,"node_id":"MDU6TGFiZWw2MzYzNTI3OTY=","url":"https://api.github.com/repos/ansible/ansible/labels/support:core","name":"support:core","color":"ededed","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-04-25T01:18:57Z","updated_at":"2018-06-18T21:05:51Z","closed_at":null,"author_association":"NONE","body":"##### ISSUE TYPE\r\n - Feature Idea\r\n\r\n##### COMPONENT NAME\r\n`user` module\r\n\r\n##### ANSIBLE VERSION\r\n```\r\n$ ansible --version\r\nansible 2.3.0.0\r\n  config file = \r\n  configured module search path = Default w/o overrides\r\n  python version = 2.7.12 (default, Jun 29 2016, 09:11:45) [GCC 5.3.0]\r\n```\r\n\r\n##### CONFIGURATION\r\nDefault unmodified.\r\n\r\n##### OS / ENVIRONMENT\r\nAlpine 3.3, Alpine 3.4, and any busybox based distro without shadow-utils\r\n\r\n##### SUMMARY\r\nThe `user` module expects `shadow-utils` (or `shadow`) to be installed so it has commands like `useradd` available. But on busybox based distros this is not normally installed as busybox itself has its own command set for adding users.\r\n\r\n##### STEPS TO REPRODUCE\r\n```bash\r\n$ ansible localhost -m user -a 'name=newuser state=present'\r\n [WARNING]: Host file not found: /etc/ansible/hosts\r\n\r\n [WARNING]: provided hosts list is empty, only localhost is available\r\n\r\nlocalhost | FAILED! => {\r\n    \"changed\": false, \r\n    \"failed\": true, \r\n    \"msg\": \"Failed to find required executable useradd in paths: /root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\r\n}\r\n\r\n# Backporting shadow-utils from Alpine 3.5 to Alpine 3.3 to make user module work\r\n$ apk add --repository https://dl-cdn.alpinelinux.org/alpine/v3.5/community --update shadow\r\nfetch https://dl-cdn.alpinelinux.org/alpine/v3.5/community/x86_64/APKINDEX.tar.gz\r\nfetch https://dl-cdn.alpinelinux.org/alpine/v3.3/main/x86_64/APKINDEX.tar.gz\r\nfetch https://dl-cdn.alpinelinux.org/alpine/v3.3/community/x86_64/APKINDEX.tar.gz\r\n(1/2) Installing linux-pam (1.2.1-r0)\r\n(2/2) Installing shadow (4.2.1-r7)\r\nExecuting busybox-1.24.2-r1.trigger\r\nOK: 233 MiB in 62 packages\r\n\r\n# Now it works\r\n$ ansible localhost -m user -a 'name=newuser state=present'\r\n [WARNING]: Host file not found: /etc/ansible/hosts\r\n\r\n [WARNING]: provided hosts list is empty, only localhost is available\r\n\r\nlocalhost | SUCCESS => {\r\n    \"changed\": true, \r\n    \"comment\": \"\", \r\n    \"createhome\": true, \r\n    \"group\": 100, \r\n    \"home\": \"/home/newuser\", \r\n    \"name\": \"newuser\", \r\n    \"shell\": \"/bin/bash\", \r\n    \"state\": \"present\", \r\n    \"stderr\": \"useradd: group '1000' does not exist\\nuseradd: the GROUP= configuration in /etc/default/useradd will be ignored\\nCreating mailbox file: No such file or directory\\n\", \r\n    \"stderr_lines\": [\r\n        \"useradd: group '1000' does not exist\", \r\n        \"useradd: the GROUP= configuration in /etc/default/useradd will be ignored\", \r\n        \"Creating mailbox file: No such file or directory\"\r\n    ], \r\n    \"system\": false, \r\n    \"uid\": 1000\r\n}\r\n```\r\n\r\n##### EXPECTED RESULTS\r\nI expected the user module to work on busybox without shadow utils installed.\r\n\r\n##### ACTUAL RESULTS\r\nPer above, it fails.\r\n\r\n```bash\r\n$ ansible localhost -m user -a 'name=newuser state=present'\r\n [WARNING]: Host file not found: /etc/ansible/hosts\r\n\r\n [WARNING]: provided hosts list is empty, only localhost is available\r\n\r\nlocalhost | FAILED! => {\r\n    \"changed\": false, \r\n    \"failed\": true, \r\n    \"msg\": \"Failed to find required executable useradd in paths: /root/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/398195639","html_url":"https://github.com/ansible/ansible/issues/23944#issuecomment-398195639","issue_url":"https://api.github.com/repos/ansible/ansible/issues/23944","id":398195639,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODE5NTYzOQ==","user":{"login":"samdoran","id":4047861,"node_id":"MDQ6VXNlcjQwNDc4NjE=","avatar_url":"https://avatars2.githubusercontent.com/u/4047861?v=4","gravatar_id":"","url":"https://api.github.com/users/samdoran","html_url":"https://github.com/samdoran","followers_url":"https://api.github.com/users/samdoran/followers","following_url":"https://api.github.com/users/samdoran/following{/other_user}","gists_url":"https://api.github.com/users/samdoran/gists{/gist_id}","starred_url":"https://api.github.com/users/samdoran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samdoran/subscriptions","organizations_url":"https://api.github.com/users/samdoran/orgs","repos_url":"https://api.github.com/users/samdoran/repos","events_url":"https://api.github.com/users/samdoran/events{/privacy}","received_events_url":"https://api.github.com/users/samdoran/received_events","type":"User","site_admin":false},"created_at":"2018-06-18T21:05:51Z","updated_at":"2018-06-18T21:05:51Z","author_association":"MEMBER","body":"Related to #30445.\r\n\r\nWe most likely need to add a class for Alpine Linux."}}
{"actor":{"display_login":"samdoran"}}