community / community.general / 0.1.1 / module / cloudscale_server Manages servers on the cloudscale.ch IaaS service Authors: Gaudenz Steinlin (@gaudenz), René Moser (@resmo), Denis Krienbühl (@href) preview | supported by communitycommunity.general.cloudscale_server (0.1.1) — module
Install with ansible-galaxy collection install community.general:==0.1.1
collections: - name: community.general version: 0.1.1
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 zone: lpg1 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 zone: lpg1 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 uuid: description: - UUID of the server. - Either I(name) or I(uuid) are required. type: str zone: description: - Zone in which the server resides (e.g. C(lgp1) or C(rma1)). type: str force: default: false description: - Allow to stop the running server for updating if necessary. type: bool image: description: - Image used to create the server. type: str state: choices: - running - stopped - absent default: running description: - State of the server. type: str flavor: description: - Flavor of the server. type: str password: description: - Password for the server. type: str 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. type: str user_data: description: - Cloud-init configuration (cloud-config) data to use for the server. type: str api_timeout: default: 30 description: - Timeout in seconds for calls to the cloudscale.ch API. type: int server_groups: description: - List of UUID or names of server groups. - Mutually exclusive with I(anti_affinity_with). type: list 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: memory_gb: 4 name: Flex-4 slug: flex-4 vcpu_count: 2 type: dict 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: default_username: ubuntu name: Ubuntu 18.04 LTS operating_system: Ubuntu slug: ubuntu-18.04 type: dict 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: community.general 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: community.general 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 zone: description: The zone used for booting this server returned: success when not state == absent sample: slug: lpg1 type: dict version_added: '2.10' version_added_collection: community.general