community.general.packet_sshkey – Create/delete an SSH key in Packet host.¶
Note
This plugin is part of the community.general collection (version 2.5.1).
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.packet_sshkey
.
Synopsis¶
Create/delete an SSH key in Packet host.
API is documented at https://www.packet.net/help/api/#page:ssh-keys,header:ssh-keys-ssh-keys-post.
Requirements¶
The below requirements are needed on the host that executes this module.
python >= 2.6
packet-python
Parameters¶
Examples¶
# All the examples assume that you have your Packet API token in env var PACKET_API_TOKEN.
# You can also pass the api token in module param auth_token.
- name: Create sshkey from string
hosts: localhost
tasks:
community.general.packet_sshkey:
key: "{{ lookup('file', 'my_packet_sshkey.pub') }}"
- name: Create sshkey from file
hosts: localhost
tasks:
community.general.packet_sshkey:
label: key from file
key_file: ~/ff.pub
- name: Remove sshkey by id
hosts: localhost
tasks:
community.general.packet_sshkey:
state: absent
id: eef49903-7a09-4ca1-af67-4087c29ab5b6
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Authors¶
Tomas Karasek (@t0mk) <tom.to.the.k@gmail.com>