@ -24,12 +24,12 @@ import tempfile
DOCUMENTATION = '''
DOCUMENTATION = '''
- - -
- - -
module : zone
module : solaris_ zone
short_description : Manage Solaris zones
short_description : Manage Solaris zones
description :
description :
- Create , start , stop and delete Solaris zones . This module doesn ' t currently allow
- Create , start , stop and delete Solaris zones . This module doesn ' t currently allow
changing of options for a zone that ' s already been created.
changing of options for a zone that ' s already been created.
version_added : " 1.5 "
version_added : " 2.0 "
author : Paul Markham
author : Paul Markham
requirements :
requirements :
- Solaris 10 or later
- Solaris 10 or later
@ -38,10 +38,10 @@ options:
required : true
required : true
description :
description :
- C ( present ) , create the zone .
- C ( present ) , create the zone .
C ( running ) , if the zone already exists , boot it , otherwise , create the zone
- C ( running ) , if the zone already exists , boot it , otherwise , create the zone
first , then boot it .
first , then boot it .
C ( stopped ) , shutdown a zone .
- C ( stopped ) , shutdown a zone .
C ( absent ) , destroy the zone .
- C ( absent ) , destroy the zone .
choices : [ ' present ' , ' running ' , ' stopped ' , ' absent ' ]
choices : [ ' present ' , ' running ' , ' stopped ' , ' absent ' ]
name :
name :
description :
description :
@ -89,21 +89,21 @@ options:
EXAMPLES = '''
EXAMPLES = '''
# Create a zone, but don't boot it
# Create a zone, but don't boot it
zone: name = zone1 state = present path = / zones / zone1 whole_root = true root_password = " Be9oX7OSwWoU. "
solaris_ zone: name = zone1 state = present path = / zones / zone1 whole_root = true root_password = " Be9oX7OSwWoU. "
config = ' set autoboot=true, add net, set physical=bge0, set address=10.1.1.1, end '
config = ' set autoboot=true, add net, set physical=bge0, set address=10.1.1.1, end '
# Create a zone and boot it
# Create a zone and boot it
zone: name = zone1 state = running path = / zones / zone1 whole_root = true root_password = " Be9oX7OSwWoU. "
solaris_ zone: name = zone1 state = running path = / zones / zone1 whole_root = true root_password = " Be9oX7OSwWoU. "
config = ' set autoboot=true, add net, set physical=bge0, set address=10.1.1.1, end '
config = ' set autoboot=true, add net, set physical=bge0, set address=10.1.1.1, end '
# Boot an already created zone
# Boot an already created zone
zone: name = zone1 state = running
solaris_ zone: name = zone1 state = running
# Stop a zone
# Stop a zone
zone: name = zone1 state = stopped
solaris_ zone: name = zone1 state = stopped
# Destroy a zone
# Destroy a zone
zone: name = zone1 state = absent
solaris_ zone: name = zone1 state = absent
'''
'''
class Zone ( object ) :
class Zone ( object ) :
@ -332,6 +332,13 @@ def main():
supports_check_mode = True
supports_check_mode = True
)
)
if platform . system ( ) == ' SunOS ' :
( major , minor ) = platform . release ( ) . split ( ' . ' )
if minor < 10 :
module . fail_json ( msg = ' This module requires Solaris 10 or later ' )
else :
module . fail_json ( msg = ' This module requires Solaris ' )
zone = Zone ( module )
zone = Zone ( module )
state = module . params [ ' state ' ]
state = module . params [ ' state ' ]