community.general.vmadm (8.5.0) — module

Manage SmartOS virtual machines and zones

Authors: Jasper Lievisse Adriaanse (@jasperla)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manage SmartOS virtual machines through vmadm(1M).

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Create SmartOS zone
  community.general.vmadm:
    brand: joyent
    state: present
    alias: fw_zone
    image_uuid: 95f265b8-96b2-11e6-9597-972f3af4b6d5
    firewall_enabled: true
    indestructible_zoneroot: true
    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
  community.general.vmadm:
    alias: test_zone
    state: deleted
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Stop all zones
  community.general.vmadm:
    uuid: '*'
    state: stopped

Inputs

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

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

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

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

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

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

brand:
    choices:
    - joyent
    - joyent-minimal
    - lx
    - kvm
    - bhyve
    default: joyent
    description:
    - Type of virtual machine. The V(bhyve) option was added in community.general 0.2.0.
    type: str

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

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

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

state:
    choices:
    - present
    - running
    - absent
    - deleted
    - stopped
    - created
    - restarted
    - rebooted
    default: running
    description:
    - States for the VM to be in. Please note that V(present), V(stopped) and V(restarted)
      operate on a VM that is currently provisioned. V(present) means that the VM will
      be created if it was absent, and that it will be in a running state. V(absent) will
      shutdown the zone before removing it. V(stopped) means the zone will be created
      if it does not exist already, before shutting it down.
    type: str

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

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

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

docker:
    description:
    - Docker images need this flag enabled along with the O(brand) set to C(lx).
    required: false
    type: bool

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

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

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

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

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

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

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

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

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

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
    type: str

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

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
    type: int

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

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

image_uuid:
    description:
    - Image UUID.
    required: false
    type: str

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

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

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

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

filesystems:
    description:
    - Mount additional filesystems into an OS VM.
    elements: dict
    required: false
    type: list

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
    type: str

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

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
    type: str

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

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

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

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

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

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

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

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

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

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

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

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

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

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
    type: int

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

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

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

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

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

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

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

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

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