phoenixnap / phoenixnap.bmc / 1.17.0 / module / ssh_key Create/delete SSH key on phoenixNAP Bare Metal Cloud. | "added in version" 0.5.0 of phoenixnap.bmc" Authors: Pavle Jojkic (@pajuga) <pavlej@phoenixnap.com>, Goran Jelenic (@goranje) <goranje@phoenixnap.com> preview | supported by certifiedphoenixnap.bmc.ssh_key (1.17.0) — module
Install with ansible-galaxy collection install phoenixnap.bmc:==1.17.0
collections: - name: phoenixnap.bmc version: 1.17.0
Create/delete SSH key on phoenixNAP Bare Metal Cloud.
This module has a dependency on requests
API is documented at U(https://developers.phoenixnap.com/docs/bmc/1/overview).
# All the examples assume that you have file config.yaml with your 'clientId' and 'clientSecret' # in location: ~/.pnap/config.yaml # and generated SSH key pair in location: ~/.ssh/ - name: Create new SSH Key for account hosts: localhost gather_facts: false vars_files: - ~/.pnap/config.yaml tasks: - name: Create a SSH Key phoenixnap.bmc.ssh_key: client_id: "{{ clientId }}" client_secret: "{{ clientSecret }}" name: mykey default: true ssh_key: "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" state: present
- name: Delete the SSH Key hosts: localhost gather_facts: false vars_files: - ~/.pnap/config.yaml tasks: - name: Delete a SSH Key phoenixnap.bmc.ssh_key: client_id: "{{ clientId }}" client_secret: "{{ clientSecret }}" name: mykey state: absent
name: description: Friendly SSH Key name to represent an SSH key. type: str state: choices: - present - absent default: present description: Indicate desired state of the target. type: str default: default: false description: Keys marked as default are always included on server creation and reset unless toggled off in creation/reset request. type: bool ssh_key: description: - SSH Key actual key value. - Once a SSH Key is created, it cannot be modified through a playbook type: str client_id: description: Client ID (Application Management) type: str client_secret: description: Client Secret (Application Management) type: str
changed: description: True if a sshkey was created or removed. returned: success sample: true type: bool ssh_key: description: Information about sshkey that were created/removed returned: success sample: '{"createdOn": "2021-06-09T10:08:22.997Z", "default": false, "fingerprint": "LOLGe4uptCUyckpjTt54FztvCxV0osG0GfcReRQdlEA", "id": "11119316fdac92144089a8493", "key": "ssh-rsa BAA#B3NzaC1yc2EAAAADwvo+6sWgRsxOTB0l... user@mycomputer", "lastUpdatedOn": "2021-06-09T10:08:22.997Z", "name": "mykey"}' type: dict