W3cubDocs

/Ansible

sl_vm - create or cancel a virtual instance in SoftLayer

New in version 2.1.

Synopsis

Creates or cancels SoftLayer instances. When created, optionally waits for it to be ‘running’.

Requirements (on host that executes module)

  • python >= 2.6
  • softlayer >= 4.1.1

Options

parameter required default choices comments
cpus
yes
Count of cpus to be assigned to new virtual instance
datacenter
no
Datacenter for the virtual instance to be deployed
dedicated
no
Falg to determine if the instance should be deployed in dedicated space
disks
yes [25]
List of disk sizes to be assigned to new virtual instance
domain
no
Domain name to be provided to a virtual instance
hostname
no
Hostname to be provided to a virtual instance
hourly
no True
Flag to determine if the instance should be hourly billed
image_id
no
Image Template to be used for new virtual instance
instance_id
no
Instance Id of the virtual instance to perform action option
local_disk
no True
Flag to determine if local disk should be used for the new instance
memory
yes
Amount of memory to be assigned to new virtual instance
nic_speed
no 10
NIC Speed to be assigned to new virtual instance
os_code
no
OS Code to be used for new virtual instance
post_uri
no
URL of a post provisioning script ot be loaded and exectued on virtual instance
private
no
Flag to determine if the instance should be private only
private_vlan
no
VLAN by its Id to be assigned to the private NIC
public_vlan
no
VLAN by its Id to be assigned to the public NIC
ssh_keys
no
List of ssh keys by their Id to be assigned to a virtual instance
state
no present
Create, or cancel a virtual instance. Specify "present" for create, "absent" to cancel.
tags
no
Tag or list of tags to be provided to a virtual instance
wait
no True
Flag used to wait for active status before returning
wait_timeout
no 600
time in seconds before wait returns

Examples

- name: Build instance
  hosts: localhost
  gather_facts: False
  tasks:
  - name: Build instance request
    local_action:
      module: 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

- name: Build additional instances
  hosts: localhost
  gather_facts: False
  tasks:
  - name: Build instances request
    local_action:
      module: 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 }


- name: Cancel instances
  hosts: localhost
  gather_facts: False
  tasks:
  - name: Cancel by tag
    local_action:
      module: sl_vm
      state: absent
      tags: ansible-module-test

This is an Extras Module

For more information on what this means please read Extras Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/sl_vm_module.html