ansible.builtin.cs_instance_password_reset (v2.9.18) — module

Allows resetting VM the default passwords on Apache CloudStack based clouds.

| "added in version" 2.8 of ansible.builtin"

Authors: Gregor Riepl (@onitake)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.18

Description

Resets the default user account's password on an instance.

Requires cloud-init to be installed in the virtual machine.

The passwordenabled flag must be set on the template associated with the VM.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: stop the virtual machine before resetting the password
  cs_instance:
    name: myvirtualmachine
    state: stopped
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: reset and get new default password
  cs_instance_password_reset:
    vm: myvirtualmachine
  register: root
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- debug:
    msg: "new default password is {{ root.password }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: boot the virtual machine to activate the new password
  cs_instance:
    name: myvirtualmachine
    state: started
  delegate_to: localhost
  when: root is changed

Inputs

    
vm:
    description:
    - Name of the virtual machine to reset the password on.
    required: true
    type: str

zone:
    description:
    - Name of the zone in which the instance is deployed.
    - If not set, the default zone is used.
    type: str

domain:
    description:
    - Name of the domain the virtual machine belongs to.
    type: str

account:
    description:
    - Account the virtual machine belongs to.
    type: str

api_key:
    description:
    - API key of the CloudStack API.
    - If not given, the C(CLOUDSTACK_KEY) env variable is considered.
    required: true
    type: str

api_url:
    description:
    - URL of the CloudStack API e.g. https://cloud.example.com/client/api.
    - If not given, the C(CLOUDSTACK_ENDPOINT) env variable is considered.
    required: true
    type: str

project:
    description:
    - Name of the project the virtual machine belongs to.
    type: str

api_secret:
    description:
    - Secret key of the CloudStack API.
    - If not set, the C(CLOUDSTACK_SECRET) env variable is considered.
    required: true
    type: str

poll_async:
    default: true
    description:
    - Poll async jobs until job has finished.
    type: bool

api_timeout:
    default: 10
    description:
    - HTTP timeout in seconds.
    - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered.
    type: int

api_http_method:
    choices:
    - get
    - post
    default: get
    description:
    - HTTP method used to query the API endpoint.
    - If not given, the C(CLOUDSTACK_METHOD) env variable is considered.
    type: str

api_verify_ssl_cert:
    description:
    - Verify CA authority cert file.
    - If not given, the C(CLOUDSTACK_VERIFY) env variable is considered.
    type: str

Outputs

id:
  description: ID of the virtual machine.
  returned: success
  sample: a6f7a5fc-43f8-11e5-a151-feff819cdc9f
  type: str
password:
  description: The new default password.
  returned: success
  sample: ahQu5nuNge3keesh
  type: str