ansible / ansible-modules-core

Ansible modules - these modules ship with ansible
1.3k stars 1.95k forks source link

user: support different root dir #5844

Closed null-git closed 7 years ago

null-git commented 7 years ago
ISSUE TYPE
COMPONENT NAME

user core module group core module

ANSIBLE VERSION
ansible 2.2.0.0
  config file = /usr/local/etc/ansible/ansible.cfg
  configured module search path = ['/usr/local/etc/ansible/modules']
CONFIGURATION
OS / ENVIRONMENT
SUMMARY

FreeBSD allows a different root path (with '-R') or a different /etc path (with '-V') to be passed to pw to allow adding and modifying users and groups in different locations i.e. FreeBSD jails on the server. In my setup there are multiple FreeBSD jails on a server that all get their base system (read-only mounted) from a slightly modified local FreeBSD installation. One of the slight modifications is to have a couple of users and groups added to the base which would be greatly simplified by having at least one of the mentioned options available. pw is already used by the user and group modules if ansible is running on FreeBSD and every pw command can be combined with the '-R /different/root' flag, so implementation shouldn't be to difficult.

STEPS TO REPRODUCE
- name: make sure www user exists in basejail
  user: name=www state=present rootdir=/jail/basejail

- name: make sure postfix group exists in basejail
  group: name=postfix state=present rootdir=/jail/basejail
EXPECTED RESULTS

The user module should invoke 'pw -R /jail/basejail useradd -n www' if the user doesn't exists in /jail/basejail/etc/passwd. And the group module should invoke 'pw -R /jail/basejail groupadd -n postfix'.

ACTUAL RESULTS

At the moment there is no way to do this.

ansibot commented 7 years ago

This repository has been locked. All new issues and pull requests should be filed in https://github.com/ansible/ansible

Please read through the repomerge page in the dev guide.