community.general.pacman_key (8.5.0) — module

Manage pacman's list of trusted keys

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

Authors: George Rawlinson (@grawlinson)

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

Add or remove gpg keys from the pacman keyring.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Import a key via local file
  community.general.pacman_key:
    id: 01234567890ABCDE01234567890ABCDE12345678
    data: "{{ lookup('file', 'keyfile.asc') }}"
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Import a key via remote file
  community.general.pacman_key:
    id: 01234567890ABCDE01234567890ABCDE12345678
    file: /tmp/keyfile.asc
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Import a key via url
  community.general.pacman_key:
    id: 01234567890ABCDE01234567890ABCDE12345678
    url: https://domain.tld/keys/keyfile.asc
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Import a key via keyserver
  community.general.pacman_key:
    id: 01234567890ABCDE01234567890ABCDE12345678
    keyserver: keyserver.domain.tld
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Import a key into an alternative keyring
  community.general.pacman_key:
    id: 01234567890ABCDE01234567890ABCDE12345678
    file: /tmp/keyfile.asc
    keyring: /etc/pacman.d/gnupg-alternative
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove a key from the keyring
  community.general.pacman_key:
    id: 01234567890ABCDE01234567890ABCDE12345678
    state: absent

Inputs

    
id:
    description:
    - The 40 character identifier of the key.
    - Including this allows check mode to correctly report the changed state.
    - Do not specify a subkey ID, instead specify the primary key ID.
    required: true
    type: str

url:
    description:
    - The URL to retrieve keyfile from.
    - Remote file must be of C(PGP PUBLIC KEY BLOCK) type.
    type: str

data:
    description:
    - The keyfile contents to add to the keyring.
    - Must be of C(PGP PUBLIC KEY BLOCK) type.
    type: str

file:
    description:
    - The path to a keyfile on the remote server to add to the keyring.
    - Remote file must be of C(PGP PUBLIC KEY BLOCK) type.
    type: path

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Ensures that the key is present (added) or absent (revoked).
    type: str

verify:
    default: true
    description:
    - Whether or not to verify the keyfile's key ID against specified key ID.
    type: bool

keyring:
    default: /etc/pacman.d/gnupg
    description:
    - The full path to the keyring folder on the remote server.
    - If not specified, module will use pacman's default (V(/etc/pacman.d/gnupg)).
    - Useful if the remote system requires an alternative gnupg directory.
    type: path

keyserver:
    description:
    - The keyserver used to retrieve key from.
    type: str

force_update:
    default: false
    description:
    - This forces the key to be updated if it already exists in the keyring.
    type: bool