morpheus.core.key_pair (0.6.0) — module

Create and Remove Key Pairs

| "added in version" 0.6.0 of morpheus.core"

Authors: James Riach

Install collection

Install with ansible-galaxy collection install morpheus.core:==0.6.0


Add to requirements.yml

  collections:
    - name: morpheus.core
      version: 0.6.0

Description

Create and Remove Key Pairs.

Keys can be user provided or generated.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Generate a Key Pair
  morpheus.core.key_pair:
    state: present
    name: My Generated Key Pair
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Add a Key Pair
  morpheus.core.key_pair:
    state: present
    name: My Existing Key Pair
    private_key: "{{ q('ansible.builtin.file', 'path/to/private_key')[0] }}"
    public_key: "{{ q('ansible.builtin.file', 'path/to/public_key)[0] }}"
    passphrase: Password123
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete a Key Pair
  morpheus.core.key_pair:
    state: absent
    id: 50

Inputs

    
id:
    description:
    - Required when I(state=absent), specify the Key Pair to remove.
    type: int

name:
    description:
    - Required when I(state=present), specify the name of the Key Pair.
    - Specifying this parameter alone will generate a Key Pair.
    type: string

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Create or Remove a Key Pair.
    type: string

passphrase:
    description:
    - Specify the Private Key passphrase.
    type: string

public_key:
    description:
    - Specify the Public Key.
    type: string

private_key:
    description:
    - Specify the Private Key.
    type: string

Outputs

errors:
  description:
  - Any errors when generating or adding a Key Pair.
  returned: always
  sample:
    errors:
      private_key: Unable to generate public key from private key
key_pair:
  description:
  - Dictionary information about the Key Pair.
  - If this was a Generated Key Pair, it will include details of the Private Key.
  returned: always
  sample:
    key_pair:
      account_id: 1
      date_created: '2023-10-23T11:56:56Z'
      fingerprint: 0f:f7:4c:5a:71:60:47:11:56:bb:1b:1f:ff:b4:70:cb
      has_private_key: false
      id: 50
      last_updated: '2023-10-23T11:56:56Z'
      name: Ansible Created Key Pair
      private_key_hash: null
      public_key: ssh-rsa AAAAB3N...