ansible / ansible.builtin / v2.3.2.0-1 / 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.3.2.0-1) — module
pip
Install with pip install ansible==2.3.2.0.post1
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.
# 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 }}'
# remove a public key by its name: - cs_sshkeypair: name: linus@example.com state: absent delegate_to: localhost
# 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 state: choices: - present - absent default: present description: - State of the public key. required: false domain: default: null description: - Domain the public key is related to. required: false account: default: null description: - Account the public key is related to. required: false 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: default: null description: - Name of the project the public key to be registered in. required: false 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: default: null description: - String of the public key. required: false 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: string id: description: UUID of the SSH public key. returned: success sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f type: string name: description: Name of the SSH public key. returned: success sample: linus@example.com type: string private_key: description: Private key of generated SSH keypair. returned: changed sample: '-----BEGIN RSA PRIVATE KEY----- MII...8tO -----END RSA PRIVATE KEY----- ' type: string