community.general.sl_vm (8.5.0) — module

Create or cancel a virtual instance in SoftLayer

Authors: Matt Colton (@mcltn)

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

Creates or cancels SoftLayer instances.

When created, optionally waits for it to be 'running'.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Build instance
  hosts: localhost
  gather_facts: false
  tasks:
  - name: Build instance request
    community.general.sl_vm:
      hostname: instance-1
      domain: anydomain.com
      datacenter: dal09
      tags: ansible-module-test
      hourly: true
      private: false
      dedicated: false
      local_disk: true
      cpus: 1
      memory: 1024
      disks: [25]
      os_code: UBUNTU_LATEST
      wait: false
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Build additional instances
  hosts: localhost
  gather_facts: false
  tasks:
  - name: Build instances request
    community.general.sl_vm:
      hostname: "{{ item.hostname }}"
      domain: "{{ item.domain }}"
      datacenter: "{{ item.datacenter }}"
      tags: "{{ item.tags }}"
      hourly: "{{ item.hourly }}"
      private: "{{ item.private }}"
      dedicated: "{{ item.dedicated }}"
      local_disk: "{{ item.local_disk }}"
      cpus: "{{ item.cpus }}"
      memory: "{{ item.memory }}"
      disks: "{{ item.disks }}"
      os_code: "{{ item.os_code }}"
      ssh_keys: "{{ item.ssh_keys }}"
      wait: "{{ item.wait }}"
    with_items:
      - hostname: instance-2
        domain: anydomain.com
        datacenter: dal09
        tags:
          - ansible-module-test
          - ansible-module-test-replicas
        hourly: true
        private: false
        dedicated: false
        local_disk: true
        cpus: 1
        memory: 1024
        disks:
          - 25
          - 100
        os_code: UBUNTU_LATEST
        ssh_keys: []
        wait: true
      - hostname: instance-3
        domain: anydomain.com
        datacenter: dal09
        tags:
          - ansible-module-test
          - ansible-module-test-replicas
        hourly: true
        private: false
        dedicated: false
        local_disk: true
        cpus: 1
        memory: 1024
        disks:
          - 25
          - 100
        os_code: UBUNTU_LATEST
        ssh_keys: []
        wait: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Cancel instances
  hosts: localhost
  gather_facts: false
  tasks:
  - name: Cancel by tag
    community.general.sl_vm:
      state: absent
      tags: ansible-module-test

Inputs

    
cpus:
    choices:
    - 1
    - 2
    - 4
    - 8
    - 16
    - 32
    - 56
    description:
    - Count of cpus to be assigned to new virtual instance.
    type: int

tags:
    description:
    - Tag or list of tags to be provided to a virtual instance.
    type: str

wait:
    default: true
    description:
    - Flag used to wait for active status before returning.
    type: bool

disks:
    default:
    - 25
    description:
    - List of disk sizes to be assigned to new virtual instance.
    elements: int
    type: list

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Create, or cancel a virtual instance.
    - Specify V(present) for create, V(absent) to cancel.
    type: str

domain:
    description:
    - Domain name to be provided to a virtual instance.
    type: str

flavor:
    description:
    - Specify which SoftLayer flavor template to use instead of cpus and memory.
    type: str
    version_added: 0.2.0
    version_added_collection: community.general

hourly:
    default: true
    description:
    - Flag to determine if the instance should be hourly billed.
    type: bool

memory:
    choices:
    - 1024
    - 2048
    - 4096
    - 6144
    - 8192
    - 12288
    - 16384
    - 32768
    - 49152
    - 65536
    - 131072
    - 247808
    description:
    - Amount of memory to be assigned to new virtual instance.
    type: int

os_code:
    description:
    - OS Code to be used for new virtual instance.
    type: str

private:
    default: false
    description:
    - Flag to determine if the instance should be private only.
    type: bool

hostname:
    description:
    - Hostname to be provided to a virtual instance.
    type: str

image_id:
    description:
    - Image Template to be used for new virtual instance.
    type: str

post_uri:
    description:
    - URL of a post provisioning script to be loaded and executed on virtual instance.
    type: str

ssh_keys:
    default: []
    description:
    - List of ssh keys by their Id to be assigned to a virtual instance.
    elements: str
    type: list

dedicated:
    default: false
    description:
    - Flag to determine if the instance should be deployed in dedicated space.
    type: bool

nic_speed:
    choices:
    - 10
    - 100
    - 1000
    description:
    - NIC Speed to be assigned to new virtual instance.
    type: int

wait_time:
    default: 600
    description:
    - Time in seconds before wait returns.
    type: int

datacenter:
    choices:
    - ams01
    - ams03
    - che01
    - dal01
    - dal05
    - dal06
    - dal09
    - dal10
    - dal12
    - dal13
    - fra02
    - fra04
    - fra05
    - hkg02
    - hou02
    - lon02
    - lon04
    - lon06
    - mel01
    - mex01
    - mil01
    - mon01
    - osl01
    - par01
    - sao01
    - sea01
    - seo01
    - sjc01
    - sjc03
    - sjc04
    - sng01
    - syd01
    - syd04
    - tok02
    - tor01
    - wdc01
    - wdc04
    - wdc06
    - wdc07
    description:
    - Datacenter for the virtual instance to be deployed.
    type: str

local_disk:
    default: true
    description:
    - Flag to determine if local disk should be used for the new instance.
    type: bool

instance_id:
    description:
    - Instance Id of the virtual instance to perform action option.
    type: str

public_vlan:
    description:
    - VLAN by its Id to be assigned to the public NIC.
    type: str

private_vlan:
    description:
    - VLAN by its Id to be assigned to the private NIC.
    type: str