Class: Ansible::Ruby::Modules::User
- Inherits:
-
Base
- Object
- Ansible::Ruby::Models::Base
- Base
- Ansible::Ruby::Modules::User
- Defined in:
- lib/ansible/ruby/modules/generated/system/user.rb
Overview
Manage user accounts and user attributes. For Windows targets, use the M(win_user) module instead.
Instance Method Summary collapse
-
#append ⇒ :yes, ...
If C(yes), add the user to the groups specified in C(groups).,If C(no), user will only be added to the groups specified in C(groups), removing them from all other groups.
-
#comment ⇒ String?
Optionally sets the description (aka I(GECOS)) of user account.
-
#create_home ⇒ :yes, ...
Unless set to C(no), a home directory will be made for the user when the account is created or if the home directory does not exist.,Changed from C(createhome) to C(create_home) in version 2.5.
-
#expires ⇒ Integer?
An expiry time for the user in epoch, it will be ignored on platforms that do not support this.
-
#force ⇒ :yes, ...
This only affects C(state=absent), it forces removal of the user and associated directories on supported platforms.
-
#generate_ssh_key ⇒ :yes, ...
Whether to generate a SSH key for the user in question.
-
#group ⇒ String?
Optionally sets the user’s primary group (takes a group name).
-
#groups ⇒ Array<String>, ...
List of groups user will be added to.
-
#hidden ⇒ Symbol?
MacOS only, optionally hide the user from the login window and system preferences.,The default will be ‘True’ if the I(system) option is used.
-
#home ⇒ Object?
Optionally set the user’s home directory.
-
#local ⇒ :yes, ...
Forces the use of “local” command alternatives on platforms that implement it.
-
#login_class ⇒ Object?
Optionally sets the user’s login class, a feature of most BSD OSs.
-
#move_home ⇒ :yes, ...
If set to C(yes) when used with C(home=), attempt to move the user’s old home directory to the specified directory if it isn’t there already and the old home exists.
-
#name ⇒ String
Name of the user to create, remove or modify.
-
#non_unique ⇒ :yes, ...
Optionally when used with the -u option, this option allows to change the user ID to a non-unique value.
-
#password ⇒ Object?
Optionally set the user’s password to this crypted value.,On macOS systems, this value has to be cleartext.
-
#password_lock ⇒ Symbol?
Lock the password (usermod -L, pw lock, usermod -C).
-
#remove ⇒ :yes, ...
This only affects C(state=absent), it attempts to remove directories associated with the user.
-
#seuser ⇒ Object?
Optionally sets the seuser type (user_u) on selinux enabled systems.
-
#shell ⇒ String?
Optionally set the user’s shell.,On macOS, before version 2.5, the default shell for non-system users was /usr/bin/false.
-
#skeleton ⇒ Object?
Optionally set a home skeleton directory.
-
#ssh_key_bits ⇒ String?
Optionally specify number of bits in SSH key to create.
-
#ssh_key_comment ⇒ String?
Optionally define the comment for the SSH key.
-
#ssh_key_file ⇒ String?
Optionally specify the SSH key filename.
-
#ssh_key_passphrase ⇒ Object?
Set a passphrase for the SSH key.
-
#ssh_key_type ⇒ String?
Optionally specify the type of SSH key to generate.
-
#state ⇒ :absent, ...
Whether the account should exist or not, taking action if the state is different from what is stated.
-
#system ⇒ :yes, ...
When creating an account C(state=present), setting this to C(yes) makes the user a system account.
-
#uid ⇒ Integer?
Optionally sets the I(UID) of the user.
-
#update_password ⇒ :always, ...
C(always) will update passwords if they differ.
Methods inherited from Base
Methods inherited from Ansible::Ruby::Models::Base
attr_option, attr_options, attribute, fix_inclusion, #initialize, remove_existing_validations, #to_h, validates
Constructor Details
This class inherits a constructor from Ansible::Ruby::Models::Base
Instance Method Details
#append ⇒ :yes, ...
Returns If C(yes), add the user to the groups specified in C(groups).,If C(no), user will only be added to the groups specified in C(groups), removing them from all other groups.
44 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 44 attribute :append |
#comment ⇒ String?
Returns Optionally sets the description (aka I(GECOS)) of user account.
21 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 21 attribute :comment |
#create_home ⇒ :yes, ...
Returns Unless set to C(no), a home directory will be made for the user when the account is created or if the home directory does not exist.,Changed from C(createhome) to C(create_home) in version 2.5.
65 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 65 attribute :create_home |
#expires ⇒ Integer?
Returns An expiry time for the user in epoch, it will be ignored on platforms that do not support this. Currently supported on GNU/Linux, FreeBSD, and DragonFlyBSD.,Since version 2.6 you can remove the expiry time specify a negative value. Currently supported on GNU/Linux and FreeBSD.
115 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 115 attribute :expires |
#force ⇒ :yes, ...
Returns This only affects C(state=absent), it forces removal of the user and associated directories on supported platforms. The behavior is the same as C(userdel –force), check the man page for C(userdel) on your system for details and support.
77 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 77 attribute :force |
#generate_ssh_key ⇒ :yes, ...
Returns Whether to generate a SSH key for the user in question. This will B(not) overwrite an existing SSH key.
88 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 88 attribute :generate_ssh_key |
#group ⇒ String?
Returns Optionally sets the user’s primary group (takes a group name).
36 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 36 attribute :group |
#groups ⇒ Array<String>, ...
Returns List of groups user will be added to. When set to an empty string C(”), C(null), or C(~), the user is removed from all groups except the primary group. (C(~) means C(null) in YAML),Before version 2.3, the only input format allowed was a comma separated string. Now this parameter accepts a list as well as a comma separated string.
40 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 40 attribute :groups |
#hidden ⇒ Symbol?
Returns macOS only, optionally hide the user from the login window and system preferences.,The default will be ‘True’ if the I(system) option is used.
25 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 25 attribute :hidden |
#home ⇒ Object?
Returns Optionally set the user’s home directory.
52 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 52 attribute :home |
#local ⇒ :yes, ...
Returns Forces the use of “local” command alternatives on platforms that implement it. This is useful in environments that use centralized authentification when you want to manipulate the local users. I.E. it uses ‘luseradd` instead of `useradd`.,This requires that these commands exist on the targeted host, otherwise it will be a fatal error.
123 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 123 attribute :local |
#login_class ⇒ Object?
Returns Optionally sets the user’s login class, a feature of most BSD OSs.
85 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 85 attribute :login_class |
#move_home ⇒ :yes, ...
Returns If set to C(yes) when used with C(home=), attempt to move the user’s old home directory to the specified directory if it isn’t there already and the old home exists.
69 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 69 attribute :move_home |
#name ⇒ String
Returns Name of the user to create, remove or modify.
13 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 13 attribute :name |
#non_unique ⇒ :yes, ...
Returns Optionally when used with the -u option, this option allows to change the user ID to a non-unique value.
29 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 29 attribute :non_unique |
#password ⇒ Object?
Returns Optionally set the user’s password to this crypted value.,On macOS systems, this value has to be cleartext. Beware of security issues.,See U(docs.ansible.com/ansible/faq.html#how-do-i-generate-crypted-passwords-for-the-user-module) for details on various ways to generate these password values.
58 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 58 attribute :password |
#password_lock ⇒ Symbol?
Returns Lock the password (usermod -L, pw lock, usermod -C). BUT implementation differs on different platforms, this option does not always mean the user cannot login via other methods. This option does not disable the user, only lock the password. Do not change the password in the same task. Currently supported on Linux, FreeBSD, DragonFlyBSD, NetBSD.
119 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 119 attribute :password_lock |
#remove ⇒ :yes, ...
Returns This only affects C(state=absent), it attempts to remove directories associated with the user. The behavior is the same as C(userdel –remove), check the man page for details and support.
81 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 81 attribute :remove |
#seuser ⇒ Object?
Returns Optionally sets the seuser type (user_u) on selinux enabled systems.
33 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 33 attribute :seuser |
#shell ⇒ String?
Returns Optionally set the user’s shell.,On macOS, before version 2.5, the default shell for non-system users was /usr/bin/false. Since 2.5, the default shell for non-system users on macOS is /bin/bash.,On other operating systems, the default shell is determined by the underlying tool being used. See Notes for details.
48 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 48 attribute :shell |
#skeleton ⇒ Object?
Returns Optionally set a home skeleton directory. Requires create_home option!.
55 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 55 attribute :skeleton |
#ssh_key_bits ⇒ String?
Returns Optionally specify number of bits in SSH key to create.
92 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 92 attribute :ssh_key_bits |
#ssh_key_comment ⇒ String?
Returns Optionally define the comment for the SSH key.
104 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 104 attribute :ssh_key_comment |
#ssh_key_file ⇒ String?
Returns Optionally specify the SSH key filename. If this is a relative filename then it will be relative to the user’s home directory.
100 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 100 attribute :ssh_key_file |
#ssh_key_passphrase ⇒ Object?
Returns Set a passphrase for the SSH key. If no passphrase is provided, the SSH key will default to having no passphrase.
108 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 108 attribute :ssh_key_passphrase |
#ssh_key_type ⇒ String?
Returns Optionally specify the type of SSH key to generate. Available SSH key types will depend on implementation present on target host.
96 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 96 attribute :ssh_key_type |
#state ⇒ :absent, ...
Returns Whether the account should exist or not, taking action if the state is different from what is stated.
61 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 61 attribute :state |
#system ⇒ :yes, ...
Returns When creating an account C(state=present), setting this to C(yes) makes the user a system account. This setting cannot be changed on existing users.
73 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 73 attribute :system |
#uid ⇒ Integer?
Returns Optionally sets the I(UID) of the user.
17 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 17 attribute :uid |
#update_password ⇒ :always, ...
Returns C(always) will update passwords if they differ. C(on_create) will only set the password for newly created users.
111 |
# File 'lib/ansible/ruby/modules/generated/system/user.rb', line 111 attribute :update_password |