community.general.oneandone_server (8.5.0) — module

Create, destroy, start, stop, and reboot a 1&1 Host server

Authors: Amel Ajdinovic (@aajdinov), Ethan Devenport (@edevenport)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Create, destroy, update, start, stop, and reboot a 1&1 Host server. When the server is created it can optionally wait for it to be 'running' before returning.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create three servers and enumerate their names
  community.general.oneandone_server:
    auth_token: oneandone_private_api_key
    hostname: node%02d
    fixed_instance_size: XL
    datacenter: US
    appliance: C5A349786169F140BCBC335675014C08
    auto_increment: true
    count: 3
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create three servers, passing in an ssh_key
  community.general.oneandone_server:
    auth_token: oneandone_private_api_key
    hostname: node%02d
    vcore: 2
    cores_per_processor: 4
    ram: 8.0
    hdds:
      - size: 50
        is_main: false
    datacenter: ES
    appliance: C5A349786169F140BCBC335675014C08
    count: 3
    wait: true
    wait_timeout: 600
    wait_interval: 10
    ssh_key: SSH_PUBLIC_KEY
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Removing server
  community.general.oneandone_server:
    auth_token: oneandone_private_api_key
    state: absent
    server: 'node01'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Starting server
  community.general.oneandone_server:
    auth_token: oneandone_private_api_key
    state: running
    server: 'node01'
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Stopping server
  community.general.oneandone_server:
    auth_token: oneandone_private_api_key
    state: stopped
    server: 'node01'

Inputs

    
ram:
    description:
    - The amount of RAM memory. It must be provided with with vcore, cores_per_processor,
      and hdds parameters.
    type: float

hdds:
    description:
    - A list of hard disks with nested "size" and "is_main" properties. It must be provided
      with vcore, cores_per_processor, and ram parameters.
    elements: dict
    type: list

wait:
    default: true
    description:
    - Wait for the server to be in state 'running' before returning. Also used for delete
      operation (set to 'false' if you don't want to wait for each individual server to
      be deleted before moving on with other tasks.)
    type: bool

count:
    default: 1
    description:
    - The number of servers to create.
    type: int

state:
    choices:
    - present
    - absent
    - running
    - stopped
    default: present
    description:
    - Define a server's state to create, remove, start or stop it.
    type: str

vcore:
    description:
    - The total number of processors. It must be provided with cores_per_processor, ram,
      and hdds parameters.
    type: int

server:
    description:
    - Server identifier (ID or hostname). It is required for all states except 'running'
      and 'present'.
    type: str

api_url:
    description:
    - Custom API URL. Overrides the ONEANDONE_API_URL environment variable.
    type: str

ssh_key:
    description:
    - User's public SSH key (contents, not path).
    type: raw

hostname:
    description:
    - The hostname or ID of the server. Only used when state is 'present'.
    type: str

appliance:
    description:
    - The operating system name or ID for the server. It is required only for 'present'
      state.
    type: str

auth_token:
    description:
    - Authenticating API token provided by 1&1. Overrides the ONEANDONE_AUTH_TOKEN environment
      variable.
    type: str

datacenter:
    choices:
    - US
    - ES
    - DE
    - GB
    default: US
    description:
    - The datacenter location.
    type: str

description:
    description:
    - The description of the server.
    type: str

server_type:
    choices:
    - cloud
    - baremetal
    - k8s_node
    default: cloud
    description:
    - The type of server to be built.
    type: str

wait_timeout:
    default: 600
    description:
    - how long before wait gives up, in seconds
    type: int

load_balancer:
    description:
    - The load balancer name or ID.
    type: str

wait_interval:
    default: 5
    description:
    - Defines the number of seconds to wait when using the wait_for methods
    type: int

auto_increment:
    default: true
    description:
    - When creating multiple servers at once, whether to differentiate hostnames by appending
      a count after them or substituting the count where there is a %02d or %03d in the
      hostname string.
    type: bool

firewall_policy:
    description:
    - The firewall policy name or ID.
    type: str

private_network:
    description:
    - The private network name or ID.
    type: str

monitoring_policy:
    description:
    - The monitoring policy name or ID.
    type: str

cores_per_processor:
    description:
    - The number of cores per processor. It must be provided with vcore, ram, and hdds
      parameters.
    type: int

fixed_instance_size:
    description:
    - The instance size name or ID of the server. It is required only for 'present' state,
      and it is mutually exclusive with vcore, cores_per_processor, ram, and hdds parameters.
    - 'The available choices are: V(S), V(M), V(L), V(XL), V(XXL), V(3XL), V(4XL), V(5XL)'
    type: str

Outputs

servers:
  description: Information about each server that was processed
  returned: always
  sample:
  - hostname: my-server
    id: server-id
  type: list