community / community.general / 1.3.11 / module / rax_keypair Create a keypair for use with Rackspace Cloud Servers Authors: Matt Martz (@sivel)community.general.rax_keypair (1.3.11) — module
Install with ansible-galaxy collection install community.general:==1.3.11
collections: - name: community.general version: 1.3.11
Create a keypair for use with Rackspace Cloud Servers
- name: Create a keypair hosts: localhost gather_facts: False tasks: - name: Keypair request local_action: module: rax_keypair credentials: ~/.raxpub name: my_keypair region: DFW register: keypair - name: Create local public key local_action: module: copy content: "{{ keypair.keypair.public_key }}" dest: "{{ inventory_dir }}/{{ keypair.keypair.name }}.pub" - name: Create local private key local_action: module: copy content: "{{ keypair.keypair.private_key }}" dest: "{{ inventory_dir }}/{{ keypair.keypair.name }}"
- name: Create a keypair hosts: localhost gather_facts: False tasks: - name: Keypair request local_action: module: rax_keypair credentials: ~/.raxpub name: my_keypair public_key: "{{ lookup('file', 'authorized_keys/id_rsa.pub') }}" region: DFW register: keypair
env: description: - Environment as configured in I(~/.pyrax.cfg), see U(https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#pyrax-configuration). type: str name: description: - Name of keypair required: true type: str state: choices: - present - absent default: present description: - Indicate desired state of the resource type: str region: description: - Region to create an instance in. type: str api_key: aliases: - password description: - Rackspace API key, overrides I(credentials). type: str username: description: - Rackspace username, overrides I(credentials). type: str tenant_id: description: - The tenant ID used for authentication. type: str public_key: description: - Public Key string to upload. Can be a file path or string type: str credentials: aliases: - creds_file description: - File to find the Rackspace credentials in. Ignored if I(api_key) and I(username) are provided. type: path tenant_name: description: - The tenant name used for authentication. type: str auth_endpoint: description: - The URI of the authentication service. - If not specified will be set to U(https://identity.api.rackspacecloud.com/v2.0/) type: str identity_type: default: rackspace description: - Authentication mechanism to use, such as rackspace or keystone. type: str validate_certs: aliases: - verify_ssl description: - Whether or not to require SSL validation of API endpoints. type: bool