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

docker.example.org:
  smartos.vm_present:
    - config:
        auto_import: true
        reprovision: true
    - vmconfig:
        image_uuid: emby/embyserver:latest
        brand: lx
        alias: mydockervm
        quota: 5
        max_physical_memory: 1024
        tags:
          label: 'my emby docker'
          owner: 'sjorge'
        resolvers:
          - 172.16.1.1
        nics:
          "82:1b:8e:49:e9:18":
            nic_tag: trunk
            mtu: 1500
            ips:
              - 172.16.1.118/24
            vlan_id: 10
        filesystems:
          "/config:
            source: "/vmdata/emby_config"
            type: lofs
            options:
              - nodevices

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

Warning

Only image_present states that are included via the top file will be detected.

salt.states.smartos.source_absent(name)

Ensure an image source is absent on the computenode

name
: string
source url
salt.states.smartos.source_present(name, source_type=u'imgapi')

Ensure an image source is present on the computenode

name
: string
source url
source_type
: string
source type (imgapi or docker)
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
  • auto_lx_vars (true) - copy kernel_version and docker:* variables from image
  • reprovision (false) - reprovision on image_uuid changes
  • enforce_tags (true) - false = add tags only, true = add, update, and remove tags
  • enforce_routes (true) - false = add tags only, true = add, update, and remove routes
  • enforce_internal_metadata (true) - false = add metadata only, true = add, update, and remove metadata
  • enforce_customer_metadata (true) - false = add metadata only, true = add, update, and remove metadata

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,...

Changed in version Fluorine: Added support for docker image uuids, added auto_lx_vars configuration, documented some missing configuration options.

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.