htpasswd

Collection: community.general

Full Name: parallax.community.general.htpasswd

Aliases: community.general.htpasswd, htpasswd

Synopsis

Manage user entries in an Apache htpasswd file

Parameters

NameTypeRequiredDefaultDescription
pathstringyesPath to the htpasswd file
namestringyesUser name to add or remove
passwordstringPassword associated with the user (required if state is present)
crypt_schemestringapr_md5_cryptEncryption scheme to use Choices: apr_md5_crypt, plaintext, sha1
statestringpresentWhether the user entry should be present or absent Choices: present, absent
createbooltrueCreate the htpasswd file if it does not exist

Example

- name: Add a user to the metrics htpasswd file
  htpasswd:
    path: /etc/nginx/metrics.htpasswd
    name: prometheus
    password: "{{ metrics_password }}"
    crypt_scheme: bcrypt
    state: present