Author: | Lorin Hochstein |
---|
New in version 1.3.
Add and remove username/password entries in a password file using htpasswd. This is used by web servers such as Apache and Nginx for basic authentication.
parameter | required | default | choices | comments |
---|---|---|---|---|
create | no | yes |
|
Used with state=present . If specified, the file will be created if it does not already exist. If set to "no", will fail if the file does not exist |
crypt_scheme | no | apr_md5_crypt |
|
Encryption scheme to be used. |
name | yes | User name to add or remove | ||
password | no | Password associated with user.Must be specified if user does not exist yet. | ||
path | yes | Path to the file that contains the usernames and passwords | ||
state | no | present |
|
Whether the user entry should be present or not |
# Add a user to a password file and ensure permissions are set
- htpasswd: path=/etc/nginx/passwdfile name=janedoe password=9s36?;fyNp owner=root group=www-data mode=0640
# Remove a user from a password file
- htpasswd: path=/etc/apache2/passwdfile name=foobar state=absent
Note
This module depends on the passlib Python library, which needs to be installed on all target systems.
Note
On Debian, Ubuntu, or Fedora: install python-passlib.
Note
On RHEL or CentOS: Enable EPEL, then install python-passlib.