solaris_zone - Manage Solaris zones

New in version 2.0.

Synopsis

  • Create, start, stop and delete Solaris zones. This module doesn’t currently allow changing of options for a zone that’s already been created.

Requirements (on host that executes module)

  • Solaris 10 or 11

Options

parameter required default choices comments
attach_options
no empty string
Extra options to the zoneadm attach command. For example, this can be used to specify whether a minimum or full update of packages is required and if any packages need to be deleted. For valid values, see zoneadm(1M)
config
no empty string
The zonecfg configuration commands for this zone. See zonecfg(1M) for the valid options and syntax. Typically this is a list of options separated by semi-colons or new lines, e.g. "set auto-boot=true;add net;set physical=bge0;set address=10.1.1.1;end"
create_options
no empty string
Extra options to the zonecfg(1M) create command.
install_options
no empty string
Extra options to the zoneadm(1M) install command. To automate Solaris 11 zone creation, use this to specify the profile XML file, e.g. install_options="-c sc_profile.xml"
name
yes
Zone name.
path
no
The path where the zone will be created. This is required when the zone is created, but not used otherwise.
root_password
no
The password hash for the root account. If not specified, the zone's root account will not have a password.
sparse
no
Whether to create a sparse (true) or whole root (false) zone.
state
yes present
  • present
  • installed
  • started
  • running
  • stopped
  • absent
  • configured
  • attached
  • detached
present, configure and install the zone.
installed, synonym for present.
running, if the zone already exists, boot it, otherwise, configure and install the zone first, then boot it.
started, synonym for running.
stopped, shutdown a zone.
absent, destroy the zone.
configured, configure the ready so that it's to be attached.
attached, attach a zone, but do not boot it.
detached, shutdown and detach a zone
timeout
no 600
Timeout, in seconds, for zone to boot.

Examples

- name: Create and install a zone, but don't boot it
  solaris_zone:
    name: zone1
    state: present
    path: /zones/zone1
    sparse: True
    root_password: Be9oX7OSwWoU.
    config: 'set autoboot=true; add net; set physical=bge0; set address=10.1.1.1; end'

- name: Create and install a zone and boot it
  solaris_zone:
    name: zone1
    state: running
    path: /zones/zone1
    root_password: Be9oX7OSwWoU.
    config: 'set autoboot=true; add net; set physical=bge0; set address=10.1.1.1; end'

- name: Boot an already installed zone
  solaris_zone:
    name: zone1
    state: running

- name: Stop a zone
  solaris_zone:
    name: zone1
    state: stopped

- name: Destroy a zone
  solaris_zone:
    name: zone1
    state: absent

- name: Detach a zone
  solaris_zone:
    name: zone1
    state: detached

- name: Configure a zone, ready to be attached
  solaris_zone:
    name: zone1
    state: configured
    path: /zones/zone1
    root_password: Be9oX7OSwWoU.
    config: 'set autoboot=true; add net; set physical=bge0; set address=10.1.1.1; end'

- name: Attach zone1
  solaris_zone:
    name: zone1
    state: attached
    attach_options: -u

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.

© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.4/solaris_zone_module.html