community.general.passwordstore (0.1.4) — lookup

manage passwords with passwordstore.org's pass utility

Authors: Patrick Deelman <patrick@patrickdeelman.nl>

Install collection

Install with ansible-galaxy collection install community.general:==0.1.4


Add to requirements.yml

  collections:
    - name: community.general
      version: 0.1.4

Description

Enables Ansible to retrieve, create or update passwords from the passwordstore.org pass utility. It also retrieves YAML style keys stored as multilines in the passwordfile.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
# Debug is used for examples, BAD IDEA to show passwords on screen
- name: Basic lookup. Fails if example/test doesn't exist
  debug:
    msg: "{{ lookup('passwordstore', 'example/test')}}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create pass with random 16 character password. If password exists just give the password
  debug:
    var: mypassword
  vars:
    mypassword: "{{ lookup('passwordstore', 'example/test create=true')}}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Different size password
  debug:
    msg: "{{ lookup('passwordstore', 'example/test create=true length=42')}}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create password and overwrite the password if it exists. As a bonus, this module includes the old password inside the pass file
  debug:
    msg: "{{ lookup('passwordstore', 'example/test create=true overwrite=true')}}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create an alphanumeric password
  debug: msg="{{ lookup('passwordstore', 'example/test create=true nosymbols=true') }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Return the value for user in the KV pair user, username
  debug:
    msg: "{{ lookup('passwordstore', 'example/test subkey=user')}}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Return the entire password file content
  set_fact:
    passfilecontent: "{{ lookup('passwordstore', 'example/test returnall=true')}}"

Inputs

    
_terms:
    description: query key.
    required: true

backup:
    default: 'no'
    description: Used with C(overwrite=yes). Backup the previous password in a subkey.
    type: bool

create:
    default: 'no'
    description: Create the password if it does not already exist.
    type: bool

length:
    default: 16
    description: The length of the generated password.
    type: integer

subkey:
    default: password
    description: Return a specific subkey of the password. When set to C(password), always
      returns the first line.

userpass:
    description: Specify a password to save, instead of a generated one.

directory:
    description: The directory of the password store.
    env:
    - name: PASSWORD_STORE_DIR

nosymbols:
    default: 'no'
    description: use alphanumeric characters.
    type: bool

overwrite:
    default: 'no'
    description: Overwrite the password if it does already exist.
    type: bool

returnall:
    default: 'no'
    description: Return all the content of the password, not only the first line.
    type: bool

passwordstore:
    default: ~/.password-store
    description: location of the password store.

Outputs

_raw:
  description:
  - a password