Management of Solaris Zones
maintainer: | Jorge Schrauwen <sjorge@blackdot.be> |
---|---|
maturity: | new |
depends: | salt.modules.zoneadm, salt.modules.zonecfg |
platform: | solaris |
New in version 2017.7.0.
Below are some examples of how to use this state. Lets start with creating a zone and installing it.
omipkg1_configuration: zone.present: - name: omipkg1 - brand: ipkg - zonepath: /zones/omipkg1 - properties: - autoboot: true - ip-type: exclusive - cpu-shares: 50 - resources: - attr: - name: owner - value: Jorge Schrauwen - type: string - attr: - name: description - value: OmniOS ipkg zone for testing - type: string - capped-memory: - physical: 64M omipkg1_installation: zone.installed: - name: omipkg1 - require: - zone: omipkg1_configuration omipkg1_running: zone.booted: - name: omipkg1 - require: - zone: omipkg1_installation
A zone without network access is not very useful. We could update the zone.present state in the example above to add a network interface or we could use a separate state for this.
omipkg1_network: zone.resource_present: - name: omipkg1 - resource_type: net - resource_selector_property: mac-addr - resource_selector_value: "02:08:20:a2:a3:10" - physical: znic1 - require: - zone: omipkg1_configuration
Since this is a single tenant system having the owner attribute is pointless. Let's remove that attribute.
Note
The following state run the omipkg1_configuration state will add it again! If the entire configuration is managed it would be better to add resource_prune and optionally the resource_selector_property properties to the resource.
omipkg1_strip_owner: zone.resource_present: - name: omipkg1 - resource_type: attr - resource_selector_property: name - resource_selector_value: owner - require: - zone: omipkg1_configuration
Let's bump the zone's CPU shares a bit.
Note
The following state run the omipkg1_configuration state will set it to 50 again. Update the entire zone configuration is managed you should update it there instead.
omipkg1_more_cpu: zone.property_present: - name: omipkg1 - property: cpu-shares - value: 100
Or we can remove the limit altogether!
Note
The following state run the omipkg1_configuration state will set it to 50 again. Update the entire zone configuration is managed you should set the property to None (nothing after the :) instead.
omipkg1_no_cpu: zone.property_absent: - name: omipkg1 - property: cpu-shares
Ensure a zone is absent
Ensure zone is attached
Ensure zone is booted
Ensure zone is detached
Export a zones configuration
Ensure zone is halted
Import a zones configuration
Note
The mode argument can be set to import
, install
, or attach
. import
: will only import the configuration install
: will import and then try to install the zone attach
: will import and then try to attach of the zone
omipkg1: zone.import: - path: /foo/bar/baz
Ensure zone is installed
Ensure a zone with certain properties and resources
Note
If the zone does not exist it will not be installed. You can use the `zone.installed`
state for this.
Note
Warning
Properties and resource will not be removed when they are absent from the state!
For properties, simple set them to `None`
.
For resources, add the `resource_prune`
property and set it to `True`
. Also specify the `resource_selector_property`
if the default is not the one you want.
Ensure property is absent
Note
This does a zoneacfg clear call. So the property may be reset to a default value! Does has the side effect of always having to be called.
Ensure property has a certain value
Ensure resource is absent
Warning
Both resource_selector_property and resource_selector_value must be provided, some properties like `name`
are already reserved by salt in there states.
Note
You can set both resource_selector_property and resource_selector_value to None for resources that do not require them.
Ensure resource exists with provided properties
Warning
Both resource_selector_property and resource_selector_value must be provided, some properties like name
are already reserved by salt in states.
Note
You can set both resource_selector_property and resource_selector_value to None for resources that do not require them.
Ensure zone is uninstalled
© 2019 SaltStack.
Licensed under the Apache License, Version 2.0.
https://docs.saltstack.com/en/latest/ref/states/all/salt.states.zone.html