salt.states.smartos

Management of SmartOS Standalone Compute Nodes

maintainer:Jorge Schrauwen <sjorge@blackdot.be>
maturity:new
depends:vmadm, imgadm
platform:smartos

New in version 2016.3.0.

vmtest.example.org:
  smartos.vm_present:
    - config:
        reprovision: true
    - vmconfig:
        image_uuid: c02a2044-c1bd-11e4-bd8c-dfc1db8b0182
        brand: joyent
        alias: vmtest
        quota: 5
        max_physical_memory: 512
        tags:
          label: 'test vm'
          owner: 'sjorge'
        nics:
          "82:1b:8e:49:e9:12":
            nic_tag: trunk
            mtu: 1500
            ips:
              - 172.16.1.123/16
              - 192.168.2.123/24
            vlan_id: 10
          "82:1b:8e:49:e9:13":
            nic_tag: trunk
            mtu: 1500
            ips:
              - dhcp
            vlan_id: 30
        filesystems:
          "/bigdata":
            source: "/bulk/data"
            type: lofs
            options:
              - ro
              - nodevices

kvmtest.example.org:
  smartos.vm_present:
    - vmconfig:
        brand: kvm
        alias: kvmtest
        cpu_type: host
        ram: 512
        vnc_port: 9
        tags:
          label: 'test kvm'
          owner: 'sjorge'
        disks:
          disk0
            size: 2048
            model: virtio
            compression: lz4
            boot: true
        nics:
          "82:1b:8e:49:e9:15":
            nic_tag: trunk
            mtu: 1500
            ips:
              - dhcp
            vlan_id: 30

cleanup_images:
  smartos.image_vacuum

Note

Keep in mind that when removing properties from vmconfig they will not get removed from the vm's current configuration, except for nics, disk, tags, ... they get removed via add_*, set_*, update_*, and remove_*. Properties must be manually reset to their default value. The same behavior as when using 'vmadm update'.

salt.states.smartos.config_absent(name)

Ensure configuration property is absent in /usbkey/config

name
: string
name of property
salt.states.smartos.config_present(name, value)

Ensure configuration property is set to value in /usbkey/config

name
: string
name of property
value
: string
value of property
salt.states.smartos.image_absent(name)

Ensure image is absent on the computenode

name
: string
uuid of image

Note

computenode.image_absent will only remove the image if it is not used by a vm.

salt.states.smartos.image_present(name)

Ensure image is present on the computenode

name
: string
uuid of image
salt.states.smartos.image_vacuum(name)

Delete images not in use or installed via image_present

salt.states.smartos.vm_absent(name, archive=False)

Ensure vm is absent on the computenode

name
: string
hostname of vm
archive
: boolean
toggle archiving of vm on removal

Note

State ID is used as hostname. Hostnames must be unique.

salt.states.smartos.vm_present(name, vmconfig, config=None)

Ensure vm is present on the computenode

name
: string
hostname of vm
vmconfig
: dict
options to set for the vm
config
: dict
fine grain control over vm_present

Note

The following configuration properties can be toggled in the config parameter.
  • kvm_reboot (true) - reboots of kvm zones if needed for a config update
  • auto_import (false) - automatic importing of missing images
  • reprovision (false) - reprovision on image_uuid changes
  • enforce_customer_metadata (true) - false = add metadata only, true = add, update, and remove metadata
  • enforce_tags (true) - false = add tags only, true = add, update, and remove tags

Note

State ID is used as hostname. Hostnames must be unique.

Note

If hostname is provided in vmconfig this will take president over the State ID. This allows multiple states to be applied to the same vm.

Note

The following instances should have a unique ID.
  • nic : mac
  • filesystem: target
  • disk : path or diskN for zvols

e.g. disk0 will be the first disk added, disk1 the 2nd,...

salt.states.smartos.vm_running(name)

Ensure vm is in the running state on the computenode

name
: string
hostname of vm

Note

State ID is used as hostname. Hostnames must be unique.

salt.states.smartos.vm_stopped(name)

Ensure vm is in the stopped state on the computenode

name
: string
hostname of vm

Note

State ID is used as hostname. Hostnames must be unique.