ansible / ansible.builtin / v2.9.13 / module / cloudscale_server Manages servers on the cloudscale.ch IaaS service | "added in version" 2.3 of ansible.builtin" Authors: Gaudenz Steinlin (@gaudenz), René Moser (@resmo) preview | supported by communityansible.builtin.cloudscale_server (v2.9.13) — module
pip
Install with pip install ansible==2.9.13
Create, update, start, stop and delete servers on the cloudscale.ch IaaS service.
# Create and start a server with an existing server group (shiny-group) - name: Start cloudscale.ch server cloudscale_server: name: my-shiny-cloudscale-server image: debian-8 flavor: flex-4 ssh_keys: ssh-rsa XXXXXXXXXX...XXXX ansible@cloudscale server_groups: shiny-group use_private_network: True bulk_volume_size_gb: 100 api_token: xxxxxx
# Start another server in anti-affinity (server group shiny-group) - name: Start second cloudscale.ch server cloudscale_server: name: my-other-shiny-server image: ubuntu-16.04 flavor: flex-8 ssh_keys: ssh-rsa XXXXXXXXXXX ansible@cloudscale server_groups: shiny-group api_token: xxxxxx
# Force to update the flavor of a running server - name: Start cloudscale.ch server cloudscale_server: name: my-shiny-cloudscale-server image: debian-8 flavor: flex-8 force: yes ssh_keys: ssh-rsa XXXXXXXXXX...XXXX ansible@cloudscale use_private_network: True bulk_volume_size_gb: 100 api_token: xxxxxx register: server1
# Stop the first server - name: Stop my first server cloudscale_server: uuid: '{{ server1.uuid }}' state: stopped api_token: xxxxxx
# Delete my second server - name: Delete my second server cloudscale_server: name: my-other-shiny-server state: absent api_token: xxxxxx
# Start a server and wait for the SSH host keys to be generated - name: Start server and wait for SSH host keys cloudscale_server: name: my-cloudscale-server-with-ssh-key image: debian-8 flavor: flex-4 ssh_keys: ssh-rsa XXXXXXXXXXX ansible@cloudscale api_token: xxxxxx register: server until: server.ssh_fingerprints is defined and server.ssh_fingerprints retries: 60 delay: 2
name: description: - Name of the Server. - Either I(name) or I(uuid) are required. type: str tags: description: - Tags assosiated with the servers. Set this to C({}) to clear any tags. type: dict version_added: '2.9' version_added_collection: ansible.builtin uuid: description: - UUID of the server. - Either I(name) or I(uuid) are required. type: str force: default: false description: - Allow to stop the running server for updating if necessary. type: bool version_added: '2.8' version_added_collection: ansible.builtin image: description: - Image used to create the server. state: choices: - running - stopped - absent default: running description: - State of the server. type: str flavor: description: - Flavor of the server. type: str api_url: default: https://api.cloudscale.ch/v1 description: - cloudscale.ch API URL. - This can also be passed in the C(CLOUDSCALE_API_URL) environment variable. type: str version_added: 1.3.0 version_added_collection: cloudscale_ch.cloud password: description: - Password for the server. type: str version_added: '2.8' version_added_collection: ansible.builtin ssh_keys: description: - List of SSH public keys. - Use the full content of your .pub file here. type: list use_ipv6: default: true description: - Enable IPv6 on the public network interface. type: bool api_token: description: - cloudscale.ch API token. - This can also be passed in the C(CLOUDSCALE_API_TOKEN) environment variable. required: true type: str user_data: description: - Cloud-init configuration (cloud-config) data to use for the server. type: str api_timeout: default: 45 description: - Timeout in seconds for calls to the cloudscale.ch API. - This can also be passed in the C(CLOUDSCALE_API_TIMEOUT) environment variable. type: int version_added: '2.5' version_added_collection: ansible.builtin server_groups: description: - List of UUID or names of server groups. - Mutually exclusive with I(anti_affinity_with). type: list version_added: '2.8' version_added_collection: ansible.builtin volume_size_gb: default: 10 description: - Size of the root volume in GB. type: int anti_affinity_with: description: - UUID of another server to create an anti-affinity group with. - Mutually exclusive with I(server_groups). - Deprecated, removed in version 2.11. type: str use_public_network: default: true description: - Attach a public network interface to the server. type: bool bulk_volume_size_gb: description: - Size of the bulk storage volume in GB. - No bulk storage volume if not set. type: int use_private_network: default: false description: - Attach a private network interface to the server. type: bool
anti_affinity_with: description: - List of servers in the same anti-affinity group - Deprecated, removed in version 2.11. returned: success when not state == absent sample: [] type: list flavor: description: The flavor that has been used for this server returned: success when not state == absent sample: flex-8 type: str href: description: API URL to get details about this server returned: success when not state == absent sample: https://api.cloudscale.ch/v1/servers/cfde831a-4e87-4a75-960f-89b0148aa2cc type: str image: description: The image used for booting this server returned: success when not state == absent sample: debian-8 type: str interfaces: description: List of network ports attached to the server returned: success when not state == absent sample: - addresses: - '...' type: public type: list name: description: The display name of the server returned: success sample: its-a-me-mario.cloudscale.ch type: str server_groups: description: List of server groups returned: success when not state == absent sample: - href: https://api.cloudscale.ch/v1/server-groups/... name: db-group uuid: '...' type: list version_added: '2.8' version_added_collection: ansible.builtin ssh_fingerprints: description: A list of SSH host key fingerprints. Will be null until the host keys could be retrieved from the server. returned: success when not state == absent sample: - ecdsa-sha2-nistp256 SHA256:XXXX - '...' type: list ssh_host_keys: description: A list of SSH host keys. Will be null until the host keys could be retrieved from the server. returned: success when not state == absent sample: - ecdsa-sha2-nistp256 XXXXX - '...' type: list state: description: The current status of the server returned: success sample: running type: str tags: description: Tags assosiated with the volume. returned: success sample: project: my project type: dict version_added: '2.9' version_added_collection: ansible.builtin uuid: description: The unique identifier for this server returned: success sample: cfde831a-4e87-4a75-960f-89b0148aa2cc type: str volumes: description: List of volumes attached to the server returned: success when not state == absent sample: - device: /dev/vda size_gb: '50' type: ssd type: list