community.general.keyring_info (8.5.0) — module

Get a passphrase using the Operating System's native keyring

| "added in version" 5.2.0 of community.general"

Authors: Alexander Hussey (@ahussey-redhat)

Install collection

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


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

This module uses the L(keyring Python library, https://pypi.org/project/keyring/) to retrieve passphrases for a given service and username from the OS' native keyring.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Retrieve password for service_name/user_name
    community.general.keyring_info:
      service: test
      username: test1
      keyring_password: "{{ keyring_password }}"
    register: test_password
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
  - name: Display password
    ansible.builtin.debug:
      msg: "{{ test_password.passphrase }}"

Inputs

    
service:
    description: The name of the service.
    required: true
    type: str

username:
    description: The user belonging to the service.
    required: true
    type: str

keyring_password:
    description: Password to unlock keyring.
    required: true
    type: str

Outputs

passphrase:
  description: A string containing the password.
  returned: success and the password exists
  sample: Password123
  type: str