vmadm - Manage SmartOS virtual machines and zones.

New in version 2.3.

Synopsis

  • Manage SmartOS virtual machines through vmadm(1M).

Requirements (on host that executes module)

  • python >= 2.6

Options

parameter required default choices comments
archive_on_delete
no
When enabled, the zone dataset will be mounted on /zones/archive upon removal.
autoboot
no
Whether or not a VM is booted when the system is rebooted.
boot
no
Set the boot order for KVM VMs.
brand
yes joyent
  • joyent
  • joyent-minimal
  • kvm
  • lx
Type of virtual machine.
cpu_cap
no
Sets a limit on the amount of CPU time that can be used by a VM. Use 0 for no cap.
cpu_shares
no
Sets a limit on the number of fair share scheduler (FSS) CPU shares for a VM. This limit is relative to all other VMs on the system.
cpu_type
no qemu64
  • qemu64
  • host
Control the type of virtual CPU exposed to KVM VMs.
customer_metadata
no
Metadata to be set and associated with this VM, this contain customer modifiable keys.
delegate_dataset
no
Whether to delegate a ZFS dataset to an OS VM.
disk_driver
no
Default value for a virtual disk model for KVM guests.
disks
no
A list of disks to add, valid properties are documented in vmadm(1M).
dns_domain
no
Domain value for /etc/hosts.
filesystems
no
Mount additional filesystems into an OS VM.
firewall_enabled
no
Enables the firewall, allowing fwadm(1M) rules to be applied.
force
no
Force a particular action (i.e. stop or delete a VM).
fs_allowed
no
Comma separated list of filesystem types this zone is allowed to mount.
hostname
no
Zone/VM hostname.
image_uuid
no
Image UUID.
indestructible_delegated
no
Adds an @indestructible snapshot to delegated datasets.
indestructible_zoneroot
no
Adds an @indestructible snapshot to zoneroot.
internal_metadata
no
Metadata to be set and associated with this VM, this contains operator generated keys.
internal_metadata_namespace
no
List of namespaces to be set as internal_metadata-only; these namespaces will come from internal_metadata rather than customer_metadata.
kernel_version
no
Kernel version to emulate for LX VMs.
limit_priv
no
Set (comma separated) list of privileges the zone is allowed to use.
maintain_resolvers
no
Resolvers in /etc/resolv.conf will be updated when updating the resolvers property.
max_locked_memory
no
Total amount of memory (in MiBs) on the host that can be locked by this VM.
max_lwps
no
Maximum number of lightweight processes this VM is allowed to have running.
max_physical_memory
no
Maximum amount of memory (in MiBs) on the host that the VM is allowed to use.
max_swap
no
Maximum amount of virtual memory (in MiBs) the VM is allowed to use.
mdata_exec_timeout
no
Timeout in seconds (or 0 to disable) for the svc:/smartdc/mdata:execute service that runs user-scripts in the zone.
name
no
Name of the VM. vmadm(1M) uses this as an optional name.
aliases: alias
nic_driver
no
Default value for a virtual NIC model for KVM guests.
nics
no
A list of nics to add, valid properties are documented in vmadm(1M).
nowait
no
Consider the provisioning complete when the VM first starts, rather than when the VM has rebooted.
qemu_extra_opts
no
Additional qemu cmdline arguments for KVM guests.
qemu_opts
no
Additional qemu arguments for KVM guests. This overwrites the default arguments provided by vmadm(1M) and should only be used for debugging.
quota
no
Quota on zone filesystems (in MiBs).
ram
no
Amount of virtual RAM for a KVM guest (in MiBs).
resolvers
no
List of resolvers to be put into /etc/resolv.conf.
routes
no
Dictionary that maps destinations to gateways, these will be set as static routes in the VM.
spice_opts
no
Addition options for SPICE-enabled KVM VMs.
spice_password
no
Password required to connect to SPICE. By default no password is set. Please note this can be read from the Global Zone.
state
yes
  • present
  • absent
  • stopped
  • restarted
States for the VM to be in. Please note that present, stopped and restarted operate on a VM that is currently provisioned. present means that the VM will be created if it was absent, and that it will be in a running state. absent will shutdown the zone before removing it. stopped means the zone will be created if it doesn't exist already, before shutting it down.
tmpfs
no
Amount of memory (in MiBs) that will be available in the VM for the /tmp filesystem.
uuid
no
UUID of the VM. Can either be a full UUID or * for all VMs.
vcpus
no
Number of virtual CPUs for a KVM guest.
vga
no
Specify VGA emulation used by KVM VMs.
virtio_txburst
no
Number of packets that can be sent in a single flush of the tx queue of virtio NICs.
virtio_txtimer
no
Timeout (in nanoseconds) for the TX timer of virtio NICs.
vnc_password
no
Password required to connect to VNC. By default no password is set. Please note this can be read from the Global Zone.
vnc_port
no
TCP port to listen of the VNC server. Or set 0 for random, or -1 to disable.
zfs_data_compression
no
Specifies compression algorithm used for this VMs data dataset. This option only has effect on delegated datasets.
zfs_data_recsize
no
Suggested block size (power of 2) for files in the delegated dataset's filesystem.
zfs_filesystem_limit
no
Maximum number of filesystems the VM can have.
zfs_io_priority
no
IO throttle priority value relative to other VMs.
zfs_root_compression
no
Specifies compression algorithm used for this VMs root dataset. This option only has effect on the zoneroot dataset.
zfs_root_recsize
no
Suggested block size (power of 2) for files in the zoneroot dataset's filesystem.
zfs_snapshot_limit
no
Number of snapshots the VM can have.
zpool
no
ZFS pool the VM's zone dataset will be created in.

Examples

- name: create SmartOS zone
  vmadm:
    brand: joyent
    state: present
    alias: fw_zone
    image_uuid: 95f265b8-96b2-11e6-9597-972f3af4b6d5
    firewall_enabled: yes
    indestructible_zoneroot: yes
    nics:
      - nic_tag: admin
        ip: dhcp
        primary: true
    internal_metadata:
      root_pw: 'secret'
    quota: 1

- name: Delete a zone
  vmadm:
    alias: test_zone
    state: deleted

- name: Stop all zones
  vmadm:
    uuid: '*'
    state: stopped

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
alias
Alias of the managed VM.
When addressing a VM by alias. string dns-zone
state
State of the target, after execution.
success string running
uuid
UUID of the managed VM.
always string b217ab0b-cf57-efd8-cd85-958d0b80be33

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

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

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