ansible.builtin.sl_vm (v2.4.2.0-1) — module

create or cancel a virtual instance in SoftLayer

| "added in version" 2.1 of ansible.builtin"

Authors: Matt Colton (@mcltn)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.4.2.0.post1

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
    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
    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-slaves
        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-slaves
        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
    sl_vm:
      state: absent
      tags: ansible-module-test

Inputs

    
cpus:
    default: null
    description:
    - Count of cpus to be assigned to new virtual instance
    required: true

tags:
    default: null
    description:
    - Tag or list of tags to be provided to a virtual instance
    required: false

wait:
    default: true
    description:
    - Flag used to wait for active status before returning
    required: false

disks:
    default:
    - 25
    description:
    - List of disk sizes to be assigned to new virtual instance
    required: true

state:
    default: present
    description:
    - Create, or cancel a virtual instance. Specify "present" for create, "absent" to
      cancel.
    required: false

domain:
    default: null
    description:
    - Domain name to be provided to a virtual instance
    required: false

hourly:
    default: true
    description:
    - Flag to determine if the instance should be hourly billed
    required: false

memory:
    default: null
    description:
    - Amount of memory to be assigned to new virtual instance
    required: true

os_code:
    default: null
    description:
    - OS Code to be used for new virtual instance
    required: false

private:
    default: false
    description:
    - Flag to determine if the instance should be private only
    required: false

hostname:
    default: null
    description:
    - Hostname to be provided to a virtual instance
    required: false

image_id:
    default: null
    description:
    - Image Template to be used for new virtual instance
    required: false

post_uri:
    default: null
    description:
    - URL of a post provisioning script to be loaded and executed on virtual instance
    required: false

ssh_keys:
    default: null
    description:
    - List of ssh keys by their Id to be assigned to a virtual instance
    required: false

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

nic_speed:
    default: 10
    description:
    - NIC Speed to be assigned to new virtual instance
    required: false

wait_time:
    default: 600
    description:
    - time in seconds before wait returns
    required: false

datacenter:
    default: null
    description:
    - Datacenter for the virtual instance to be deployed
    required: false

local_disk:
    default: true
    description:
    - Flag to determine if local disk should be used for the new instance
    required: false

instance_id:
    default: null
    description:
    - Instance Id of the virtual instance to perform action option
    required: false

public_vlan:
    default: null
    description:
    - VLAN by its Id to be assigned to the public NIC
    required: false

private_vlan:
    default: null
    description:
    - VLAN by its Id to be assigned to the private NIC
    required: false