gcore / gcore.cloud / 1.0.1 / module / keypair Manages keypair Authors: GCore (@GCore)gcore.cloud.keypair (1.0.1) — module
Install with ansible-galaxy collection install gcore.cloud:==1.0.1
collections: - name: gcore.cloud version: 1.0.1
Create/delete or share keypair
- name: Create new keypair gcore.cloud.keypair: api_key: "{{ api_key }}" region_id: "{{ region_id }}" project_id: "{{ project_id }}" command: create sshkey_name: "alice"
- name: Share keypair in project gcore.cloud.keypair: api_key: "{{ api_key }}" region_id: "{{ region_id }}" project_id: "{{ project_id }}" command: share keypair_id: "{{ keypair_id }}" shared_in_project: true
- name: Un-share keypair in project gcore.cloud.keypair: api_key: "{{ api_key }}" region_id: "{{ region_id }}" project_id: "{{ project_id }}" command: share keypair_id: "{{ keypair_id }}" shared_in_project: false
- name: Delete keypair gcore.cloud.keypair: api_key: "{{ api_key }}" region_id: "{{ region_id }}" project_id: "{{ project_id }}" command: delete keypair_id: "{{ keypair_id }}"
api_key: description: - GCore API auth key - Can be passed as I(CLOUD_API_KEY) environment variable. type: str command: choices: - create - delete - share description: - Operation to perform. required: true type: str api_host: default: https://api.gcore.com/cloud description: - GCore API base host - Can be passed as I(CLOUD_API_HOST) environment variable. type: str region_id: description: - GCore API region ID - Required if I(region_name) is not passed - Can be passed as I(CLOUD_REGION_ID) environment variable. type: int keypair_id: description: - The ID of keypair - Required if I(command) is update or delete required: false type: str project_id: description: - GCore API project ID - Required if I(project_name) is not passed - Can be passed as I(CLOUD_PROJECT_ID) environment variable. type: int public_key: description: - Public part of the key. To generate public and private keys - Used if I(command) is create. required: false type: str api_timeout: default: 30 description: - Timeout in seconds to polling GCore API type: int region_name: description: - GCore API region name - Required if I(region_id) is not passed - Can be passed as I(CLOUD_REGION_NAME) environment variable. type: str sshkey_name: description: - Key name. - Required if I(command) is create. required: false type: str project_name: description: - GCore API project name - Required if I(project_id) is not passed - Can be passed as I(CLOUD_PROJECT_NAME) environment variable. type: str shared_in_project: description: - Keypair is shared. - Required if I(command) is share required: false type: bool
network: contains: created_at: description: - Datetime object. It automatically is being generated when the keypair is created or imported. returned: always sample: '2021-11-10T06:58:11' type: str fingerprint: description: Key fingerprint returned: if available sample: 86:75:ce:e7:e9:1e:f0:79:ec:6f:d8:92:9b:43:fc:4d type: str private_key: description: Private part of the key returned: if available sample: null type: str project_id: description: Project ID returned: always sample: 1 type: int public_key: description: Public part of the key returned: always sample: ''' ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDFHrnwGVBZs6q6vmTBzQFfzdRLQW8N6Rd0ogGe3h8tm83ZJLTTsF+1H4JcOvwI5ETkHMaFIWd2U1 5nHU5M7plE6UPRKfzy4rq6yI6cE4tojd3A9attMpbEEX7EbGKrbrb4AsjzxHKAVaREAb31ZplJkUlsiees25hTQXBcWQ nOESlc9RCxZ/QQgNUUgqm7QGg7CNkL8Mpq9V4YaOhcFGWj0jXP1CL3g6Xe3xJo1CmUbkIOGUyAmrSfLEiy2O91iOUhbm YQyXksznNrT9O6uLkijf6syLZOdyAuUd/Z86eYXej4/YsvIA5eIFU4B6y9zOXEO2A81txPYMRAytYt7+e7 alice@alice ''' type: str shared_in_project: description: Keypair is shared for all users in the project returned: always sample: false type: bool sshkey_id: description: Key ID, equal to sshkey_name returned: always sample: alice type: str sshkey_name: description: Key name returned: always sample: alice type: str state: description: Key state returned: always sample: ACTIVE type: str description: - Response depends of I(command). - If I(command) is one of create or share then response will be resource dictionary. - If I(command) is delete then response will be a dict with resource id. returned: always type: complex