summaryrefslogtreecommitdiffstats
path: root/lib/ansible/modules/user.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ansible/modules/user.py')
-rw-r--r--lib/ansible/modules/user.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/lib/ansible/modules/user.py b/lib/ansible/modules/user.py
index 6d465b0..e896581 100644
--- a/lib/ansible/modules/user.py
+++ b/lib/ansible/modules/user.py
@@ -3,8 +3,7 @@
# Copyright: (c) 2012, Stephen Fromm <sfromm@gmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-from __future__ import absolute_import, division, print_function
-__metaclass__ = type
+from __future__ import annotations
DOCUMENTATION = r'''
@@ -73,8 +72,8 @@ options:
- Optionally set the user's shell.
- On macOS, before Ansible 2.5, the default shell for non-system users was V(/usr/bin/false).
Since Ansible 2.5, the default shell for non-system users on macOS is V(/bin/bash).
- - See notes for details on how other operating systems determine the default shell by
- the underlying tool.
+ - On other operating systems, the default shell is determined by the underlying tool
+ invoked by this module. See Notes for a per platform list of invoked tools.
type: str
home:
description:
@@ -306,6 +305,11 @@ EXAMPLES = r'''
uid: 1040
group: admin
+- name: Create a user 'johnd' with a home directory
+ ansible.builtin.user:
+ name: johnd
+ create_home: yes
+
- name: Add the user 'james' with a bash shell, appending the group 'admins' and 'developers' to the user's groups
ansible.builtin.user:
name: james
@@ -632,6 +636,9 @@ class User(object):
# sha512
if fields[1] == '6' and len(fields[-1]) != 86:
maybe_invalid = True
+ # yescrypt
+ if fields[1] == 'y' and len(fields[-1]) != 43:
+ maybe_invalid = True
else:
maybe_invalid = True
if maybe_invalid:
@@ -1063,12 +1070,6 @@ class User(object):
exists = True
break
- if not exists:
- self.module.warn(
- "'local: true' specified and user '{name}' was not found in {file}. "
- "The local user account may already exist if the local account database exists "
- "somewhere other than {file}.".format(file=self.PASSWORDFILE, name=self.name))
-
return exists
else: