Commit Graph

25 Commits (0709c48f6403f43ea31a4a6ac8fb57985321a05f)

Author SHA1 Message Date
Stephen Fromm 6742e9c3f4 Add option required=(True|False) to get_bin_path and update modules
Added required as optional argument to get_bin_path(). It defaults to
false.  Updated following modules to use required=True when calling
get_bin_path():  apt_repository, easy_install, group, pip,
supervisorctl, and user.
Also removed _find_supervisorctl() from supervisorctl module and updated
_is_running() to not need it.
12 years ago
Stephen Fromm e5a635672c Migrate remaining modules to use get_bin_path in module_common.py
* Migraed easy_install, pip, service, setup, and user.
* Updated fail_json message in apt_repository
* Fixed easy_install to not hardcode location of virtualenv in
  /usr/local/bin/.
* Made handling of virtualenv more consistent between easy_install and
  pip.
12 years ago
Michael DeHaan 477ca2ed1a Make pep8 tests run against the library directory as well, and associated tweaks (mostly to indentation) in the library
directory.
12 years ago
Stephen Fromm 49f3ab6757 Abstract how to look up user password to be more flexible
This adds user_password() to abstract how the user's password is looked
up.  If spwd is not available, this will read the shadow file for the
user's shadow entry.  This will then facilitate idempotent password
changes on hosts without spwd.
12 years ago
Michael DeHaan 7e9e29011e Add encoding lines to python modules such that they can take unicode options if they are fed them, since the
AnsibleModule stuff no longer base64 encodes for simplicity and speed reasons.
12 years ago
Michael DeHaan ce5f3dd148 Port the file module over to the new common code infrastructure + cleanup some redundant imports since the module code already imports those things. 12 years ago
Mark Theunissen 97cc259d8c Undefined variable error 12 years ago
Stephen Fromm f068bedfa1 Update user module to use new shared module code 12 years ago
Michael DeHaan 64c51ade1e Change the way we do with_items to make them happen next to each other in runner, which eliminates the problem of with_items and vars_files sometimes not playing nice with each other.
(Also a fix for the user module error handling when the user
is not present at the time of the return.  This can only really be caused by multiple ansible executions).
12 years ago
Jeremy Smitherman ecacb67d31 Added yes/no to user options instead of False comparison for force and remove options for user module 13 years ago
Stephen Fromm ac3341cc12 Minor fix to user module to further streamline setting 'changed' flag 13 years ago
Michael DeHaan 3235da074e Merge pull request #568 from sfromm/user
User modules fixes
13 years ago
Stephen Fromm 09f025b7a0 Fixes to user module for better error handling
The user module now returns the output, both stdout and stderr, from
useradd, usermod, and userdel.  This should help debug cases why one of
those commands fail.  In addition, the user module will now call
fail_json() when the attempted command failed so as to properly
communicate a failure in a playbook.
13 years ago
Seth Vidal 2f11350665 modify user module so that password is NEVER logged before the command runs 13 years ago
Brad Olson 2b8bc789c2 Remove call to undefined debug() in module 'user'.
I think when we stopped using stderr for debugging modules because
paramiko didn't like it, many modules used the idiom of defining
a debug function that used standard error. The def's and calls were
removed.

This looks like a stray debug() that didn't get removed and didn't
show up unless you alter a user's groups. If it's hit, 'user' fails
with a global undefined function error.
13 years ago
Stephen Fromm aea022b002 Apply logging of arguments to modules (issue #122)
The ohai and facter modules use /usr/bin/logger to log the fact that
they have been invoked.  I added 'import os' to the ping module
so that it could have the same syslog statements as the other modules.
I separated the condensed:
    shlex.split(open(argfile, 'r').read())
into two separate statements similar to the other modules.
13 years ago
Stephen Fromm 73ffec9710 Move import of spwd under a try block
Resolves issue #333.  If spwd is not available, the password will
be set regardless.
13 years ago
Brendan Beveridge 5059588b17 remove now useless append check in user_mod 13 years ago
Brendan Beveridge 2635195185 Fixes issue #315
This adds some logic when usings groups possibly in combination with append

  if just specifying groups and the current groups do not match the list
     set groups
  if specifying groups with append and any group thats not in the current groups
     set groups with -a
13 years ago
Jeroen Hoekx 2c8fbdbd20 Group order in user module should not matter.
Groups are not necessarily returned in the defined order, especially when the user already existed before ansible started managing the system.
13 years ago
Daniel Néri a837009c5d Add 'system' option for user and group modules
Creates system accounts/groups; corresponds to the '-r' option for {user,group}add.

The option is only honored when users/groups are added, not when modified.
13 years ago
Michael DeHaan 36e454c52f Because paramiko using a pty can't distinguish stderr and stdout, remove handling that
treated -D as a way to show stderr, and make sure modules don't include things on stderr.
Update docs and test module script to come into line.
13 years ago
Stephen Fromm 416eb36b9a Update user module to support supplementary group membership
This adds two options to the user module: groups and append.  groups is
a comma-delimited list of supplementary groups a user should belong to.
If a user is currently a member of a group not listed in groups, the
user will be removed from it.  To change this behavior, use append=yes.
This will append the user to the list of supplementary groups and *not*
remove the user from unlisted groups.
13 years ago
Stephen Fromm 8592b3b40d Update user module to support group name
This changes the gid option to group.  One may provide a primary group
as either a gid or a name.  The module will then check to verify that
the group already exists.  If the group does not already exist, the
module will fail.
13 years ago
Stephen Fromm f4835477b0 Add user module to create, modify, and delete user accounts
This relies on useradd, usermod, and userdel utilities on the system.
The argument name is required; if state is not provided, present is
assumed.  Other options supported for creating or modifying an existing
account:  uid, gid, comment, home, shell, and password.  If managing the
password, it must already be encrypted.  When creating an account, you
can also provide the argument createhome to control whether the home
directory is created.  Arguments supported for deleting an account are:
force (remove account even if user is logged in) and remove (remove home
directory).
13 years ago