scaleuptechnologies.utils.opnsense_authorized_key (1.2.5) — module

Adds or removes an SSH authorized key

| "added in version" 1.0.0 of scaleuptechnologies.utils"

Authors: Sven Anders

Install collection

Install with ansible-galaxy collection install scaleuptechnologies.utils:==1.2.5


Add to requirements.yml

  collections:
    - name: scaleuptechnologies.utils
      version: 1.2.5

Description

Adds or removes SSH authorized keys for particular user accounts.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Set authorized key taken from file
  opnsense_authorized_key:
    user: charlie
    state: present
    key: "{{ lookup('file', '/home/charlie/.ssh/id_rsa.pub') }}"

Inputs

    
key:
    description:
    - The SSH public key(s), as a string or (since Ansible 1.9) url (https://github.com/username.keys).
    required: true
    type: str

user:
    description:
    - The username on the remote host whose authorized_keys file will be modified.
    required: true
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Whether the given key (with the given key_options) should or should not be in the
      file.
    type: str

comment:
    description:
    - Change the comment on the public key.
    - Rewriting the comment is useful in cases such as fetching it from GitHub or GitLab.
    - If no comment is specified, the existing comment will be kept.
    type: str

key_options:
    description:
    - A string of ssh key options to be prepended to the key in the authorized_keys file.
    type: str

Outputs

key:
  description: The key that the module was running against.
  returned: success
  sample: https://github.com/user.keys
  type: str
key_option:
  description: Key options related to the key.
  returned: success
  sample: null
  type: str
state:
  description: Whether the given key (with the given key_options) should or should
    not be in the file
  returned: success
  sample: present
  type: str
unique:
  description: Whether the key is unique
  returned: success
  sample: false
  type: bool
user:
  description: The username on the remote host whose authorized_keys file will be
    modified
  returned: success
  sample: user
  type: str