ansible / ansible.builtin / v2.9.18 / module / cs_sshkeypair Manages SSH keys on Apache CloudStack based clouds. | "added in version" 2.0 of ansible.builtin" Authors: René Moser (@resmo) stableinterface | supported by communityansible.builtin.cs_sshkeypair (v2.9.18) — module
pip
Install with pip install ansible==2.9.18
Create, register and remove SSH keys.
If no key was found and no public key was provided and a new SSH private/public key pair will be created and the private key will be returned.
- name: create a new private / public key pair cs_sshkeypair: name: linus@example.com delegate_to: localhost register: key
- debug: msg: 'Private key is {{ key.private_key }}'
- name: remove a public key by its name cs_sshkeypair: name: linus@example.com state: absent delegate_to: localhost
- name: register your existing local public key cs_sshkeypair: name: linus@example.com public_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" delegate_to: localhost
name: description: - Name of public key. required: true type: str state: choices: - present - absent default: present description: - State of the public key. type: str domain: description: - Domain the public key is related to. type: str account: description: - Account the public key is related to. type: str api_key: description: - API key of the CloudStack API. - If not given, the C(CLOUDSTACK_KEY) env variable is considered. required: true type: str api_url: description: - URL of the CloudStack API e.g. https://cloud.example.com/client/api. - If not given, the C(CLOUDSTACK_ENDPOINT) env variable is considered. required: true type: str project: description: - Name of the project the public key to be registered in. type: str api_secret: description: - Secret key of the CloudStack API. - If not set, the C(CLOUDSTACK_SECRET) env variable is considered. required: true type: str public_key: description: - String of the public key. type: str api_timeout: default: 10 description: - HTTP timeout in seconds. - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered. type: int api_http_method: choices: - get - post default: get description: - HTTP method used to query the API endpoint. - If not given, the C(CLOUDSTACK_METHOD) env variable is considered. type: str api_verify_ssl_cert: description: - Verify CA authority cert file. - If not given, the C(CLOUDSTACK_VERIFY) env variable is considered. type: str
fingerprint: description: Fingerprint of the SSH public key. returned: success sample: 86:5e:a3:e8:bd:95:7b:07:7c:c2:5c:f7:ad:8b:09:28 type: str id: description: UUID of the SSH public key. returned: success sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f type: str name: description: Name of the SSH public key. returned: success sample: linus@example.com type: str private_key: description: Private key of generated SSH keypair. returned: changed sample: '-----BEGIN RSA PRIVATE KEY----- MII...8tO -----END RSA PRIVATE KEY----- ' type: str