serverscom / serverscom.sc_api / 0.1.0 / module / sc_cloud_computing_instance_state Manage instance states | "added in version" 1.0.0 of serverscom.sc_api" Authors: George Shuklin (@amarao) preview | supported by communityserverscom.sc_api.sc_cloud_computing_instance_state (0.1.0) — module
Install with ansible-galaxy collection install serverscom.sc_api:==0.1.0
collections: - name: serverscom.sc_api version: 0.1.0
Allow to control power state and rescue mode for instance. This module does not allow removal and creation of the instance, use M(serverscom.sc_api.sc_cloud_computing_instance) with state=present/absent.
- name: Shutdown instance sc_cloud_computing_instance_state: token: '{{ sc_token }}' instance_id: M7e5Ba2v state: shutdown wait: 60
- name: Switch to rescue mode by name sc_cloud_computing_instance_state: token: '{{ sc_token }}' name: myinstance region_id: 3 state: rescue wait: 600
- name: Switch instance to normal mode sc_cloud_computing_instance_state: token: '{{ sc_token }}' name: test4 state: normal
- name: Reboot instance sc_cloud_computing_instance_state: token: '{{ sc_token }}' name: app state: rebooted when: reboot_condition
name: aliases: - instance_name description: - Name of the instance to set PTR records for. - If more than one server with a given name found, module will fail. - Use I(instance_id) for precise identification. - Mutually exclusive with I(instance_id). type: str wait: default: 600 description: - Time to wait until instance get to the desired state. - I(state)=C(shutdown) waits for SWITCHED_OFF. - I(state)=C(rescue) waits for RESCUE. - I(state)=C(normal) waits for ACTIVE. - I(state)=C(rebooted) waits for ACTIVE. - Value C(0) is used to disable wait. - If C(0) is set, module works in 'fire-and-forget' mode. - ACTIVE state doesn't mean that instance is ready to accept ssh connections. Use M(ansible.builtin.wait_for_connection) module wait until instance finishes booting. handlers or when statement may be used to preserve idempotency. required: false type: int state: choices: - shutdown - rescue - normal - rebooted description: - Make sure instance in I(state) mode. - Module will fail if operation is impossible (f.e. migrating) or absent. - C(shutdown) shutdown instance. - C(rescue) reboot instance in rescue mode. - C(normal) turn instanse on or exit in rescue mode. - C(rebooted) reboot instance. This state cause non non-idempotent action. required: true type: str token: description: - Token to use. - You can create token for you account in https://portal.servers.com in Profile -> Public API section. required: true type: str endpoint: default: https://api.servers.com/v1 description: - Endpoint to use to connect to API. - Do not change until specifically asked to do otherwise. type: str image_id: description: - Image id to use for I(state)=C(rescue) - Mutually exclusive with I(image_regexp) - Original instance image will be used if I(image_id) and I(image_regexp) are not specified. type: str region_id: description: - Region ID to search instance by name. - All regions are searched if not specified. - Used only if I(name) present. type: int instance_id: description: - Id of the instance to manage PTR records for. - Mutually exclusive with I(name). type: str image_regexp: description: - Regular expression to search image by name to use for I(state)=C(rescue). - Original instance image will be used if I(image_id) and I(image_regexp) are not specified. - Mutually exclusive with I(image_id). - First matching image is used. type: str update_interval: default: 5 description: - Polling interval for waiting. - Every polling request is reducing API ratelimits. required: false type: int
api_url: description: URL for the failed request returned: on failure type: str created_at: description: - Date of creation of the instance. returned: on success type: str flavor_id: description: - Id of the instance's flavor. returned: on success type: str flavor_name: description: - Human-readable name of the instance's flavor. returned: on success type: str gpn: description: - Flag is Global Private Network was enabled for instance. - Flag may not prepresent private_ipv4_address if private interface was detached via Openstack API. returned: on success type: bool id: description: - Id of the instance. returned: on success type: str image_id: description: - Id of the image or snapshot used for instance build/rebuild. returned: on success type: str image_name: description: - Name of the image. - May be absent if image was removed. returned: on success type: str ipv6: description: - Flag if IPv6 was enabled for instance. returned: on success type: bool name: description: - Name of the instance. returned: on success type: str openstack_uuid: description: - UUID of the instance in the Openstack API. - May be missing at some stages of lifecycle. returned: on success type: str private_ipv4_address: description: - IPv4 address for instance. - May be missing if no private network is connected to the instance. returned: on success type: str public_ipv4_address: description: - IPv4 address for instance. - May be missing if public inteface was detached via Openstack API. returned: on success type: str public_ipv6_address: description: - IPv5 address for instance. - May be missing if no IPv6 address was ordered or public inteface was detached via Openstack API. returned: on success type: str region_code: description: - Human-readable code for region. returned: on success type: str region_id: description: - Id of the region. - Same as in I(region_id). returned: on success type: int status: description: - Current status for the instance. - ACTIVE - a normal, operational status of a cloud instance. - SWITCHED_OFF, SWITCHING_OFF, SWITCHING_ON, REBOOTING - power states for ACTIVE instance. - PENDING - order for new instance is been processed. - CREATING, BUILDING, REBUILDING, PROVISIONING, DELETING and DELETED stages of lifecycle. - AWAITING_UPGRADE_CONFIRM - instance is waiting for confirm (instances are autoconfirm in 72hr.) - UPGRADING, REVERTING_UPGRADE - stages of upgrade lifecycle. - CREATING_SNAPSHOT - Instance snapshot is creating. - BUSY - Instance is not available for API operations. - ERROR - Instance was failed or wasn't created. - KEYPAIR_NOT_FOUND - SSH key wasn't found, please check if you are using a correct key. - QUOTA_EXCEEDED - at creation time, chosen flavor exceeded quota. Please contact support for raising quota. - RESCUING, RESCUE - states for rescue operation for instance. returned: on success type: str status_code: description: Status code for the request returned: on failure type: int updated_at: description: - Date of last update for the instance. returned: on success type: str