opentelekomcloud.keypair
OpenTelekomCloud Keypair Role
This is an Ansible role that helps create a KeyPair, adds the public key to the Open Telekom Cloud Key Pair storage, and saves the private key locally as <prefix>KeyPair.pem
.
Requirements
You need to have the openstacksdk
installed on the machine where you are running this. Also, you need to be able to connect to the Open Telekom Cloud (OTC).
Role Variables
Here are the variables you can use, along with their default values (check defaults/main.yml
for more details):
Prefix for the resources:
prefix: test-
Keypair name:
keypair_name: "{{ (prefix + 'KeyPair') }}"
Where to save the private key:
keypair_private_key_dest: "{{ '~/.ssh/keypair.pem' }}"
Force key deletion (set to true to delete):
force_delete_key: false
State: whether to create (
present
) or delete (absent
):state: present
Dependencies
You need an active connection to Open Telekom Cloud, either by using the clouds.yaml
file of OpenStackSDK or existing OpenStack environment variables.
Example Playbook
Here’s a simple example of how to use the role:
- hosts: localhost
roles:
- opentelekomcloud.keypair
If you want to change the default prefix for the public key name, you can do it like this:
- hosts: localhost
roles:
- { role: opentelekomcloud.keypair, keypair_name: 'My_beautiful_key' }
To delete a keypair, you can do it easily by setting state
to absent
:
- hosts: localhost
roles:
- { role: opentelekomcloud.keypair, state: 'absent' }
If you also want to delete the private key, set force_delete_key
to true
:
- hosts: localhost
roles:
- { role: opentelekomcloud.keypair, state: 'absent', force_delete_key: 'true' }
License
Apache License
Author Information
OpenTelekomCloud
ansible-galaxy install opentelekomcloud.keypair