PARALLAX

server

Manages servers on the cloudscale.ch IaaS service

Collection: cloudscale_ch.cloud

Full Name: cloudscale_ch.cloud.server

Synopsis

Manages servers on the cloudscale.ch IaaS service

Parameters

NameTypeRequiredDefaultDescription
api_urlstrCloudscale API URL; defaults from CLOUDSCALE_API_URL or https://api.cloudscale.ch/v1.
api_tokenstrAPI bearer token; defaults from CLOUDSCALE_API_TOKEN.
api_timeoutintRequest timeout seconds; defaults from CLOUDSCALE_API_TIMEOUT or 45.
bulk_volume_size_gbintSize of the bulk storage volume in GB. No bulk storage volume if not set.
flavorstrFlavor of the server.
forceboolfalseAllow to stop the running server for updating if necessary.
imagestrImage used to create the server.
interfaceslistList of network interface objects specifying the interfaces to be attached to the server. See U(https://www.cloudscale.ch/en/api/v1/#interfaces-attribute-specification) for more details.
namestrName of the Server. Either I(name) or I(uuid) are required.
passwordstrPassword for the server.
server_groupslistList of UUID or names of server groups.
ssh_keyslistList of SSH public keys. Use the full content of your .pub file here.
statestrrunningState of the server.
tagsdictTags assosiated with the servers. Set this to C({}) to clear any tags.
use_ipv6booltrueEnable IPv6 on the public network interface.
use_private_networkboolAttach a private network interface to the server.
use_public_networkboolAttach a public network interface to the server.
user_datastrCloud-init configuration (cloud-config) data to use for the server.
uuidstrUUID of the server. Either I(name) or I(uuid) are required.
volume_size_gbint10Initial size of the root volume in GB. This parameter has no effect on existing servers. Use the volume module to change the size of the root volume.
zonestrZone in which the server resides (e.g. C(lpg1) or C(rma1)).

Example

yaml
# Create and start a server with an existing server group (shiny-group)
- name: Start cloudscale.ch server
  cloudscale_ch.cloud.server:
    name: my-shiny-cloudscale-server
    image: debian-10
    flavor: flex-4-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_ch.cloud.server:
    name: my-other-shiny-server
    image: ubuntu-16.04
    flavor: flex-8-2
    ssh_keys:
        - ssh-rsa XXXXXXXXXX...XXXX 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_ch.cloud.server:
    name: my-shiny-cloudscale-server
    image: debian-10
    flavor: flex-8-2
    force: true
    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_ch.cloud.server:
    uuid: '{{ server1.uuid }}'
    state: stopped
    api_token: xxxxxx

# Delete my second server
- name: Delete my second server
  cloudscale_ch.cloud.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_ch.cloud.server:
    name: my-cloudscale-server-with-ssh-key
    image: debian-10
    flavor: flex-4-2
    ssh_keys:
        - ssh-rsa XXXXXXXXXX...XXXX ansible@cloudscale
    api_token: xxxxxx
  register: server
  until: server is not failed
  retries: 5
  delay: 2

# Start a server with two network interfaces:
#
#    A public interface with IPv4/IPv6
#    A private interface on a specific private network with an IPv4 address
- name: Start a server with a public and private network interface
  cloudscale_ch.cloud.server:
    name: my-cloudscale-server-with-two-network-interfaces
    image: debian-10
    flavor: flex-4-2
    ssh_keys:
        - ssh-rsa XXXXXXXXXX...XXXX ansible@cloudscale
    api_token: xxxxxx
    interfaces:
        - network: 'public'
        - addresses:
            - subnet: UUID_of_private_subnet

# Start a server with a specific IPv4 address from subnet range
- name: Start a server with a specific IPv4 address from subnet range
  cloudscale_ch.cloud.server:
    name: my-cloudscale-server-with-specific-address
    image: debian-10
    flavor: flex-4-2
    ssh_keys:
        - ssh-rsa XXXXXXXXXX...XXXX ansible@cloudscale
    api_token: xxxxxx
    interfaces:
        - addresses:
            - subnet: UUID_of_private_subnet
              address: 'A.B.C.D'

# Start a server with two network interfaces:
#
#    A public interface with IPv4/IPv6
#    A private interface on a specific private network with no IPv4 address
- name: Start a server with a private network interface and no IP address
  cloudscale_ch.cloud.server:
    name: my-cloudscale-server-with-specific-address
    image: debian-10
    flavor: flex-4-2
    ssh_keys:
        - ssh-rsa XXXXXXXXXX...XXXX ansible@cloudscale
    api_token: xxxxxx
    interfaces:
        - network: 'public'
        - network: UUID_of_private_network
          addresses: []
Search
    ↑ ↓ move↵ openesc close