community.general.sl_vm – create or cancel a virtual instance in SoftLayer
community.general.sl_vm – create or cancel a virtual instance in SoftLayer
Note
This plugin is part of the community.general collection (version 2.0.1).
To install it use: ansible-galaxy collection install community.general
.
To use it in a playbook, specify: community.general.sl_vm
.
Synopsis
- Creates or cancels SoftLayer instances.
- When created, optionally waits for it to be ‘running’.
Requirements
The below requirements are needed on the host that executes this module.
- python >= 2.6
- softlayer >= 4.1.1
Parameters
Parameter | Choices/Defaults | Comments |
---|---|---|
cpus integer |
|
Count of cpus to be assigned to new virtual instance. |
datacenter string |
|
Datacenter for the virtual instance to be deployed. |
dedicated boolean |
|
Flag to determine if the instance should be deployed in dedicated space. |
disks list / elements=string |
Default: [25] |
List of disk sizes to be assigned to new virtual instance. |
domain string |
Domain name to be provided to a virtual instance. | |
flavor string added in 0.2.0 of community.general |
Specify which SoftLayer flavor template to use instead of cpus and memory. | |
hostname string |
Hostname to be provided to a virtual instance. | |
hourly boolean |
|
Flag to determine if the instance should be hourly billed. |
image_id string |
Image Template to be used for new virtual instance. | |
instance_id string |
Instance Id of the virtual instance to perform action option. | |
local_disk boolean |
|
Flag to determine if local disk should be used for the new instance. |
memory integer |
|
Amount of memory to be assigned to new virtual instance. |
nic_speed integer |
|
NIC Speed to be assigned to new virtual instance. |
os_code string |
OS Code to be used for new virtual instance. | |
post_uri string |
URL of a post provisioning script to be loaded and executed on virtual instance. | |
private boolean |
|
Flag to determine if the instance should be private only. |
private_vlan string |
VLAN by its Id to be assigned to the private NIC. | |
public_vlan string |
VLAN by its Id to be assigned to the public NIC. | |
ssh_keys list / elements=string |
List of ssh keys by their Id to be assigned to a virtual instance. | |
state string |
|
Create, or cancel a virtual instance. Specify |
tags string |
Tag or list of tags to be provided to a virtual instance. | |
wait boolean |
|
Flag used to wait for active status before returning. |
wait_time integer |
Default: 600 |
Time in seconds before wait returns. |
Examples
- name: Build instance
hosts: localhost
gather_facts: no
tasks:
- name: Build instance request
community.general.sl_vm:
hostname: instance-1
domain: anydomain.com
datacenter: dal09
tags: ansible-module-test
hourly: yes
private: no
dedicated: no
local_disk: yes
cpus: 1
memory: 1024
disks: [25]
os_code: UBUNTU_LATEST
wait: no
- name: Build additional instances
hosts: localhost
gather_facts: no
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-slaves
hourly: yes
private: no
dedicated: no
local_disk: yes
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: yes
private: no
dedicated: no
local_disk: yes
cpus: 1
memory: 1024
disks:
- 25
- 100
os_code: UBUNTU_LATEST
ssh_keys: []
wait: yes
- name: Cancel instances
hosts: localhost
gather_facts: no
tasks:
- name: Cancel by tag
community.general.sl_vm:
state: absent
tags: ansible-module-test
Authors
- Matt Colton (@mcltn)
© 2012–2018 Michael DeHaan
© 2018–2021 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.11/collections/community/general/sl_vm_module.html