ansible.builtin.vmadm (v2.9.27) — module

Manage SmartOS virtual machines and zones.

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

Authors: Jasper Lievisse Adriaanse (@jasperla)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

Manage SmartOS virtual machines through vmadm(1M).


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete a zone
  vmadm:
    alias: test_zone
    state: deleted
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Stop all zones
  vmadm:
    uuid: '*'
    state: stopped

Inputs

    
ram:
    description:
    - Amount of virtual RAM for a KVM guest (in MiBs).
    required: false

vga:
    description:
    - Specify VGA emulation used by KVM VMs.
    required: false

boot:
    description:
    - Set the boot order for KVM VMs.
    required: false

name:
    aliases:
    - alias
    description:
    - Name of the VM. vmadm(1M) uses this as an optional name.
    required: false

nics:
    description:
    - A list of nics to add, valid properties are documented in vmadm(1M).
    required: false

uuid:
    description:
    - UUID of the VM. Can either be a full UUID or C(*) for all VMs.
    required: false

brand:
    choices:
    - joyent
    - joyent-minimal
    - kvm
    - lx
    default: joyent
    description:
    - Type of virtual machine.
    required: true

disks:
    description:
    - A list of disks to add, valid properties are documented in vmadm(1M).
    required: false

force:
    description:
    - Force a particular action (i.e. stop or delete a VM).
    required: false

quota:
    description:
    - Quota on zone filesystems (in MiBs).
    required: false

state:
    choices:
    - present
    - absent
    - stopped
    - restarted
    description:
    - States for the VM to be in. Please note that C(present), C(stopped) and C(restarted)
      operate on a VM that is currently provisioned. C(present) means that the VM will
      be created if it was absent, and that it will be in a running state. C(absent) will
      shutdown the zone before removing it. C(stopped) means the zone will be created
      if it doesn't exist already, before shutting it down.
    required: true

tmpfs:
    description:
    - Amount of memory (in MiBs) that will be available in the VM for the C(/tmp) filesystem.
    required: false

vcpus:
    description:
    - Number of virtual CPUs for a KVM guest.
    required: false

zpool:
    description:
    - ZFS pool the VM's zone dataset will be created in.
    required: false

docker:
    description:
    - Docker images need this flag enabled along with the I(brand) set to C(lx).
    required: false
    version_added: '2.5'
    version_added_collection: ansible.builtin

nowait:
    description:
    - Consider the provisioning complete when the VM first starts, rather than when the
      VM has rebooted.
    required: false

routes:
    description:
    - Dictionary that maps destinations to gateways, these will be set as static routes
      in the VM.
    required: false

cpu_cap:
    description:
    - Sets a limit on the amount of CPU time that can be used by a VM. Use C(0) for no
      cap.
    required: false

autoboot:
    description:
    - Whether or not a VM is booted when the system is rebooted.
    required: false

cpu_type:
    choices:
    - qemu64
    - host
    default: qemu64
    description:
    - Control the type of virtual CPU exposed to KVM VMs.
    required: false

hostname:
    description:
    - Zone/VM hostname.
    required: false

max_lwps:
    description:
    - Maximum number of lightweight processes this VM is allowed to have running.
    required: false

max_swap:
    description:
    - Maximum amount of virtual memory (in MiBs) the VM is allowed to use.
    required: false

vnc_port:
    description:
    - TCP port to listen of the VNC server. Or set C(0) for random, or C(-1) to disable.
    required: false

qemu_opts:
    description:
    - Additional qemu arguments for KVM guests. This overwrites the default arguments
      provided by vmadm(1M) and should only be used for debugging.
    required: false

resolvers:
    description:
    - List of resolvers to be put into C(/etc/resolv.conf).
    required: false

cpu_shares:
    description:
    - 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.
    required: false

dns_domain:
    description:
    - Domain value for C(/etc/hosts).
    required: false

fs_allowed:
    description:
    - Comma separated list of filesystem types this zone is allowed to mount.
    required: false

image_uuid:
    description:
    - Image UUID.
    required: false

limit_priv:
    description:
    - Set (comma separated) list of privileges the zone is allowed to use.
    required: false

nic_driver:
    description:
    - Default value for a virtual NIC model for KVM guests.
    required: false

spice_opts:
    description:
    - Addition options for SPICE-enabled KVM VMs.
    required: false

disk_driver:
    description:
    - Default value for a virtual disk model for KVM guests.
    required: false

filesystems:
    description:
    - Mount additional filesystems into an OS VM.
    required: false

vnc_password:
    description:
    - Password required to connect to VNC. By default no password is set. Please note
      this can be read from the Global Zone.
    required: false

kernel_version:
    description:
    - Kernel version to emulate for LX VMs.
    required: false

spice_password:
    description:
    - Password required to connect to SPICE. By default no password is set. Please note
      this can be read from the Global Zone.
    required: false

virtio_txburst:
    description:
    - Number of packets that can be sent in a single flush of the tx queue of virtio NICs.
    required: false

virtio_txtimer:
    description:
    - Timeout (in nanoseconds) for the TX timer of virtio NICs.
    required: false

qemu_extra_opts:
    description:
    - Additional qemu cmdline arguments for KVM guests.
    required: false

zfs_io_priority:
    description:
    - IO throttle priority value relative to other VMs.
    required: false

delegate_dataset:
    description:
    - Whether to delegate a ZFS dataset to an OS VM.
    required: false

firewall_enabled:
    description:
    - Enables the firewall, allowing fwadm(1M) rules to be applied.
    required: false

zfs_data_recsize:
    description:
    - Suggested block size (power of 2) for files in the delegated dataset's filesystem.
    required: false

zfs_root_recsize:
    description:
    - Suggested block size (power of 2) for files in the zoneroot dataset's filesystem.
    required: false

archive_on_delete:
    description:
    - When enabled, the zone dataset will be mounted on C(/zones/archive) upon removal.
    required: false

customer_metadata:
    description:
    - Metadata to be set and associated with this VM, this contain customer modifiable
      keys.
    required: false

internal_metadata:
    description:
    - Metadata to be set and associated with this VM, this contains operator generated
      keys.
    required: false

max_locked_memory:
    description:
    - Total amount of memory (in MiBs) on the host that can be locked by this VM.
    required: false

maintain_resolvers:
    description:
    - Resolvers in C(/etc/resolv.conf) will be updated when updating the I(resolvers)
      property.
    required: false

mdata_exec_timeout:
    description:
    - Timeout in seconds (or 0 to disable) for the C(svc:/smartdc/mdata:execute) service
      that runs user-scripts in the zone.
    required: false

zfs_snapshot_limit:
    description:
    - Number of snapshots the VM can have.
    required: false

max_physical_memory:
    description:
    - Maximum amount of memory (in MiBs) on the host that the VM is allowed to use.
    required: false

zfs_data_compression:
    description:
    - Specifies compression algorithm used for this VMs data dataset. This option only
      has effect on delegated datasets.
    required: false

zfs_filesystem_limit:
    description:
    - Maximum number of filesystems the VM can have.
    required: false

zfs_root_compression:
    description:
    - Specifies compression algorithm used for this VMs root dataset. This option only
      has effect on the zoneroot dataset.
    required: false

indestructible_zoneroot:
    description:
    - Adds an C(@indestructible) snapshot to zoneroot.
    required: false

indestructible_delegated:
    description:
    - Adds an C(@indestructible) snapshot to delegated datasets.
    required: false

internal_metadata_namespace:
    description:
    - List of namespaces to be set as I(internal_metadata-only); these namespaces will
      come from I(internal_metadata) rather than I(customer_metadata).
    required: false

Outputs

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