community / community.general / 0.1.1 / module / cs_instance_password_reset Allows resetting VM the default passwords on Apache CloudStack based clouds. Authors: Gregor Riepl (@onitake) preview | supported by communitycommunity.general.cs_instance_password_reset (0.1.1) — module
Install with ansible-galaxy collection install community.general:==0.1.1
collections: - name: community.general version: 0.1.1
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.
- name: stop the virtual machine before resetting the password cs_instance: name: myvirtualmachine state: stopped delegate_to: localhost
- name: reset and get new default password cs_instance_password_reset: vm: myvirtualmachine register: root delegate_to: localhost
- debug: msg: "new default password is {{ root.password }}"
- name: boot the virtual machine to activate the new password cs_instance: name: myvirtualmachine state: started delegate_to: localhost when: root is changed
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. - As the last option, the value is taken from the ini config file, also see the notes. 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. - As the last option, the value is taken from the ini config file, also see the notes. type: str project: description: - Name of the project the virtual machine belongs to. type: str api_region: default: cloudstack description: - Name of the ini section in the C(cloustack.ini) file. - If not given, the C(CLOUDSTACK_REGION) env variable is considered. type: str api_secret: description: - Secret key of the CloudStack API. - If not set, the C(CLOUDSTACK_SECRET) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. type: str poll_async: default: true description: - Poll async jobs until job has finished. type: bool api_timeout: description: - HTTP timeout in seconds. - If not given, the C(CLOUDSTACK_TIMEOUT) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. - Fallback value is 10 seconds if not specified. type: int api_http_method: choices: - get - post description: - HTTP method used to query the API endpoint. - If not given, the C(CLOUDSTACK_METHOD) env variable is considered. - As the last option, the value is taken from the ini config file, also see the notes. - Fallback value is C(get) if not specified. type: str
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