2013-08-13 16:27:45 +02:00
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Adam Miller (maxamillion@fedoraproject.org)
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
DOCUMENTATION = '''
- - -
module : firewalld
short_description : Manage arbitrary ports / services with firewalld
description :
2014-11-20 21:48:41 +01:00
- This module allows for addition or deletion of services and ports either tcp or udp in either running or permanent firewalld rules .
2013-09-21 08:06:34 +02:00
version_added : " 1.4 "
2013-08-13 16:27:45 +02:00
options :
service :
description :
2014-11-20 21:48:41 +01:00
- " Name of a service to add/remove to/from firewalld - service must be listed in /etc/services. "
2013-08-13 16:27:45 +02:00
required : false
default : null
port :
description :
2014-11-20 21:48:41 +01:00
- " Name of a port or port range to add/remove to/from firewalld. Must be in the form PORT/PROTOCOL or PORT-PORT/PROTOCOL for port ranges. "
2013-08-13 16:27:45 +02:00
required : false
default : null
2013-10-10 15:09:52 +02:00
rich_rule :
description :
2014-11-20 21:48:41 +01:00
- " Rich rule to add/remove to/from firewalld. "
2013-10-10 15:09:52 +02:00
required : false
default : null
2014-11-21 14:26:47 +01:00
source :
description :
- ' The source/network you would like to add/remove to/from firewalld '
required : false
default : null
2015-06-29 14:18:09 +02:00
version_added : " 2.0 "
2016-01-10 23:18:09 +01:00
interface :
description :
2016-01-16 23:02:58 +01:00
- ' The interface you would like to add/remove to/from a zone in firewalld '
2016-01-10 23:18:09 +01:00
required : false
default : null
2016-01-16 23:02:58 +01:00
version_added : " 2.1 "
2013-08-13 16:27:45 +02:00
zone :
description :
- ' The firewalld zone to add/remove to/from (NOTE: default zone can be configured per system but " public " is default from upstream. Available choices can be extended based on per-system configs, listed here are " out of the box " defaults). '
required : false
default : system - default ( public )
2015-08-28 17:38:58 +02:00
choices : [ " work " , " drop " , " internal " , " external " , " trusted " , " home " , " dmz " , " public " , " block " ]
2013-08-13 16:27:45 +02:00
permanent :
description :
2014-11-20 21:48:41 +01:00
- " Should this configuration be in the running firewalld configuration or persist across reboots. "
2016-01-21 14:23:36 +01:00
required : false
default : null
2014-09-27 02:50:10 +02:00
immediate :
description :
- " Should this configuration be applied immediately, if set as permanent "
required : false
default : false
version_added : " 1.9 "
2013-08-13 16:27:45 +02:00
state :
description :
2014-11-20 21:48:41 +01:00
- " Should this port accept(enabled) or reject(disabled) connections. "
2013-08-13 16:27:45 +02:00
required : true
2015-08-28 17:38:58 +02:00
choices : [ " enabled " , " disabled " ]
2013-08-13 16:27:45 +02:00
timeout :
description :
2014-11-20 21:48:41 +01:00
- " The amount of time the rule should be in effect for when non-permanent. "
2013-08-13 16:27:45 +02:00
required : false
default : 0
2016-04-16 14:15:00 +02:00
masquerade :
description :
- ' The masquerade setting you would like to enable/disable to/from zones within firewalld '
required : false
default : null
version_added : " 2.1 "
2013-08-13 16:27:45 +02:00
notes :
2015-05-27 20:54:26 +02:00
- Not tested on any Debian based system .
2016-07-13 16:26:13 +02:00
- Requires the python2 bindings of firewalld , which may not be installed by default if the distribution switched to python 3
2015-05-27 20:54:26 +02:00
requirements : [ ' firewalld >= 0.2.11 ' ]
2015-09-08 15:28:05 +02:00
author : " Adam Miller (@maxamillion) "
2013-08-13 16:27:45 +02:00
'''
EXAMPLES = '''
- firewalld : service = https permanent = true state = enabled
- firewalld : port = 8081 / tcp permanent = true state = disabled
2014-11-20 21:48:41 +01:00
- firewalld : port = 161 - 162 / udp permanent = true state = enabled
2013-08-13 16:27:45 +02:00
- firewalld : zone = dmz service = http permanent = true state = enabled
2013-10-10 15:09:52 +02:00
- firewalld : rich_rule = ' rule service name= " ftp " audit limit value= " 1/m " accept ' permanent = true state = enabled
2016-09-12 11:27:45 +02:00
- firewalld : source = ' 192.0.2.0/24 ' zone = internal state = enabled
2016-01-10 23:18:09 +01:00
- firewalld : zone = trusted interface = eth2 permanent = true state = enabled
2016-04-16 14:15:00 +02:00
- firewalld : masquerade = yes state = enabled permanent = true zone = dmz
2013-08-13 16:27:45 +02:00
'''
import os
import re
try :
2013-08-17 00:29:57 +02:00
import firewall . config
FW_VERSION = firewall . config . VERSION
2015-10-11 15:17:23 +02:00
from firewall . client import Rich_Rule
2013-08-13 16:27:45 +02:00
from firewall . client import FirewallClient
fw = FirewallClient ( )
2016-09-12 23:57:10 +02:00
HAS_FIREWALLD = True
2013-08-13 16:27:45 +02:00
except ImportError :
2015-05-27 20:54:26 +02:00
HAS_FIREWALLD = False
2013-08-13 16:27:45 +02:00
2016-04-16 14:15:00 +02:00
#####################
# masquerade handling
#
def get_masquerade_enabled ( zone ) :
if fw . queryMasquerade ( zone ) == True :
return True
else :
return False
def get_masquerade_enabled_permanent ( zone ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
if fw_settings . getMasquerade ( ) == True :
return True
else :
return False
def set_masquerade_enabled ( zone ) :
fw . addMasquerade ( zone )
def set_masquerade_disabled ( zone ) :
fw . removeMasquerade ( zone )
def set_masquerade_permanent ( zone , masquerade ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
fw_settings . setMasquerade ( masquerade )
fw_zone . update ( fw_settings )
2013-08-13 16:27:45 +02:00
################
# port handling
#
def get_port_enabled ( zone , port_proto ) :
if port_proto in fw . getPorts ( zone ) :
return True
else :
return False
def set_port_enabled ( zone , port , protocol , timeout ) :
fw . addPort ( zone , port , protocol , timeout )
def set_port_disabled ( zone , port , protocol ) :
fw . removePort ( zone , port , protocol )
def get_port_enabled_permanent ( zone , port_proto ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
if tuple ( port_proto ) in fw_settings . getPorts ( ) :
return True
else :
return False
def set_port_enabled_permanent ( zone , port , protocol ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
fw_settings . addPort ( port , protocol )
fw_zone . update ( fw_settings )
def set_port_disabled_permanent ( zone , port , protocol ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
fw_settings . removePort ( port , protocol )
fw_zone . update ( fw_settings )
2014-11-21 14:26:47 +01:00
####################
# source handling
2015-09-08 15:28:05 +02:00
#
2014-11-21 14:26:47 +01:00
def get_source ( zone , source ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
if source in fw_settings . getSources ( ) :
return True
else :
return False
def add_source ( zone , source ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
fw_settings . addSource ( source )
2015-09-08 15:28:05 +02:00
fw_zone . update ( fw_settings )
2014-11-21 14:26:47 +01:00
def remove_source ( zone , source ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
fw_settings . removeSource ( source )
2015-09-08 15:28:05 +02:00
fw_zone . update ( fw_settings )
2013-08-13 16:27:45 +02:00
2016-01-10 23:18:09 +01:00
####################
# interface handling
#
def get_interface ( zone , interface ) :
2016-05-02 17:16:07 +02:00
if interface in fw . getInterfaces ( zone ) :
return True
else :
return False
def change_zone_of_interface ( zone , interface ) :
fw . changeZoneOfInterface ( zone , interface )
def remove_interface ( zone , interface ) :
fw . removeInterface ( zone , interface )
def get_interface_permanent ( zone , interface ) :
2016-01-10 23:18:09 +01:00
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
if interface in fw_settings . getInterfaces ( ) :
return True
else :
return False
2016-05-02 17:16:07 +02:00
def change_zone_of_interface_permanent ( zone , interface ) :
2016-01-10 23:18:09 +01:00
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
2016-05-02 17:16:07 +02:00
old_zone_name = fw . config ( ) . getZoneOfInterface ( interface )
if old_zone_name != zone :
if old_zone_name :
old_zone_obj = fw . config ( ) . getZoneByName ( old_zone_name )
old_zone_settings = old_zone_obj . getSettings ( )
old_zone_settings . removeInterface ( interface ) # remove from old
old_zone_obj . update ( old_zone_settings )
fw_settings . addInterface ( interface ) # add to new
fw_zone . update ( fw_settings )
def remove_interface_permanent ( zone , interface ) :
2016-01-10 23:18:09 +01:00
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
fw_settings . removeInterface ( interface )
fw_zone . update ( fw_settings )
2013-08-13 16:27:45 +02:00
####################
# service handling
#
2013-10-03 01:52:53 +02:00
def get_service_enabled ( zone , service ) :
2013-08-13 16:27:45 +02:00
if service in fw . getServices ( zone ) :
return True
else :
return False
def set_service_enabled ( zone , service , timeout ) :
fw . addService ( zone , service , timeout )
def set_service_disabled ( zone , service ) :
fw . removeService ( zone , service )
def get_service_enabled_permanent ( zone , service ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
if service in fw_settings . getServices ( ) :
return True
else :
return False
def set_service_enabled_permanent ( zone , service ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
fw_settings . addService ( service )
fw_zone . update ( fw_settings )
def set_service_disabled_permanent ( zone , service ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
fw_settings . removeService ( service )
fw_zone . update ( fw_settings )
2015-09-08 15:28:05 +02:00
2013-10-10 15:09:52 +02:00
####################
# rich rule handling
#
def get_rich_rule_enabled ( zone , rule ) :
2015-10-11 15:17:23 +02:00
# Convert the rule string to standard format
# before checking whether it is present
rule = str ( Rich_Rule ( rule_str = rule ) )
2013-10-10 15:09:52 +02:00
if rule in fw . getRichRules ( zone ) :
return True
else :
return False
def set_rich_rule_enabled ( zone , rule , timeout ) :
fw . addRichRule ( zone , rule , timeout )
def set_rich_rule_disabled ( zone , rule ) :
fw . removeRichRule ( zone , rule )
def get_rich_rule_enabled_permanent ( zone , rule ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
2015-10-11 15:17:23 +02:00
# Convert the rule string to standard format
# before checking whether it is present
rule = str ( Rich_Rule ( rule_str = rule ) )
2013-10-10 15:09:52 +02:00
if rule in fw_settings . getRichRules ( ) :
return True
else :
return False
def set_rich_rule_enabled_permanent ( zone , rule ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
fw_settings . addRichRule ( rule )
fw_zone . update ( fw_settings )
def set_rich_rule_disabled_permanent ( zone , rule ) :
fw_zone = fw . config ( ) . getZoneByName ( zone )
fw_settings = fw_zone . getSettings ( )
fw_settings . removeRichRule ( rule )
fw_zone . update ( fw_settings )
2013-08-13 16:27:45 +02:00
def main ( ) :
module = AnsibleModule (
argument_spec = dict (
service = dict ( required = False , default = None ) ,
port = dict ( required = False , default = None ) ,
2013-10-10 15:09:52 +02:00
rich_rule = dict ( required = False , default = None ) ,
2013-08-13 16:27:45 +02:00
zone = dict ( required = False , default = None ) ,
2014-09-27 02:50:10 +02:00
immediate = dict ( type = ' bool ' , default = False ) ,
2014-11-21 14:26:47 +01:00
source = dict ( required = False , default = None ) ,
permanent = dict ( type = ' bool ' , required = False , default = None ) ,
2013-08-13 16:27:45 +02:00
state = dict ( choices = [ ' enabled ' , ' disabled ' ] , required = True ) ,
2013-10-10 08:41:42 +02:00
timeout = dict ( type = ' int ' , required = False , default = 0 ) ,
2016-01-10 23:18:09 +01:00
interface = dict ( required = False , default = None ) ,
2016-04-16 14:15:00 +02:00
masquerade = dict ( required = False , default = None ) ,
2013-08-13 16:27:45 +02:00
) ,
supports_check_mode = True
)
2014-11-21 14:26:47 +01:00
if module . params [ ' source ' ] == None and module . params [ ' permanent ' ] == None :
2016-03-17 18:07:47 +01:00
module . fail_json ( msg = ' permanent is a required parameter ' )
2013-08-13 16:27:45 +02:00
2016-01-10 23:18:09 +01:00
if module . params [ ' interface ' ] != None and module . params [ ' zone ' ] == None :
module . fail ( msg = ' zone is a required parameter ' )
2015-05-27 20:54:26 +02:00
if not HAS_FIREWALLD :
2015-11-29 23:48:50 +01:00
module . fail_json ( msg = ' firewalld and its python 2 module are required for this module ' )
2015-05-27 20:54:26 +02:00
2013-08-17 00:29:57 +02:00
## Pre-run version checking
if FW_VERSION < " 0.2.11 " :
module . fail_json ( msg = ' unsupported version of firewalld, requires >= 2.0.11 ' )
2016-09-12 23:57:10 +02:00
## Check for firewalld running
try :
if fw . connected == False :
module . fail_json ( msg = ' firewalld service must be running ' )
except AttributeError :
module . fail_json ( msg = " firewalld connection can ' t be established, \
installed version ( % s ) likely too old . Requires firewalld > = 2.0 .11 " % F W_VERSION)
2013-08-17 00:29:57 +02:00
2013-08-13 16:27:45 +02:00
## Global Vars
changed = False
msgs = [ ]
service = module . params [ ' service ' ]
2013-10-10 15:09:52 +02:00
rich_rule = module . params [ ' rich_rule ' ]
2014-11-21 14:26:47 +01:00
source = module . params [ ' source ' ]
2013-08-13 16:27:45 +02:00
if module . params [ ' port ' ] != None :
port , protocol = module . params [ ' port ' ] . split ( ' / ' )
if protocol == None :
module . fail_json ( msg = ' improper port format (missing protocol?) ' )
else :
port = None
if module . params [ ' zone ' ] != None :
zone = module . params [ ' zone ' ]
else :
zone = fw . getDefaultZone ( )
permanent = module . params [ ' permanent ' ]
desired_state = module . params [ ' state ' ]
2014-09-27 02:50:10 +02:00
immediate = module . params [ ' immediate ' ]
2013-08-13 16:27:45 +02:00
timeout = module . params [ ' timeout ' ]
2016-01-10 23:18:09 +01:00
interface = module . params [ ' interface ' ]
2016-04-16 14:15:00 +02:00
masquerade = module . params [ ' masquerade ' ]
2013-10-10 15:09:52 +02:00
modification_count = 0
if service != None :
modification_count + = 1
if port != None :
modification_count + = 1
if rich_rule != None :
modification_count + = 1
2016-01-10 23:18:09 +01:00
if interface != None :
modification_count + = 1
2016-04-16 14:15:00 +02:00
if masquerade != None :
modification_count + = 1
2013-10-10 15:09:52 +02:00
if modification_count > 1 :
2016-01-10 23:18:09 +01:00
module . fail_json ( msg = ' can only operate on port, service, rich_rule or interface at once ' )
2013-08-13 16:27:45 +02:00
if service != None :
if permanent :
is_enabled = get_service_enabled_permanent ( zone , service )
msgs . append ( ' Permanent operation ' )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
set_service_enabled_permanent ( zone , service )
changed = True
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
set_service_disabled_permanent ( zone , service )
changed = True
2014-09-27 02:50:10 +02:00
if immediate or not permanent :
2013-08-13 16:27:45 +02:00
is_enabled = get_service_enabled ( zone , service )
msgs . append ( ' Non-permanent operation ' )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
set_service_enabled ( zone , service , timeout )
changed = True
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
set_service_disabled ( zone , service )
changed = True
if changed == True :
msgs . append ( " Changed service %s to %s " % ( service , desired_state ) )
2014-11-21 14:26:47 +01:00
if source != None :
is_enabled = get_source ( zone , source )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
add_source ( zone , source )
changed = True
msgs . append ( " Added %s to zone %s " % ( source , zone ) )
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
remove_source ( zone , source )
changed = True
msgs . append ( " Removed %s from zone %s " % ( source , zone ) )
2016-01-10 23:18:09 +01:00
2013-08-13 16:27:45 +02:00
if port != None :
if permanent :
is_enabled = get_port_enabled_permanent ( zone , [ port , protocol ] )
msgs . append ( ' Permanent operation ' )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
set_port_enabled_permanent ( zone , port , protocol )
changed = True
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
set_port_disabled_permanent ( zone , port , protocol )
changed = True
2014-09-27 02:50:10 +02:00
if immediate or not permanent :
2013-08-13 16:27:45 +02:00
is_enabled = get_port_enabled ( zone , [ port , protocol ] )
msgs . append ( ' Non-permanent operation ' )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
set_port_enabled ( zone , port , protocol , timeout )
changed = True
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
set_port_disabled ( zone , port , protocol )
changed = True
if changed == True :
msgs . append ( " Changed port %s to %s " % ( " %s / %s " % ( port , protocol ) , \
desired_state ) )
2013-10-10 15:09:52 +02:00
if rich_rule != None :
if permanent :
is_enabled = get_rich_rule_enabled_permanent ( zone , rich_rule )
msgs . append ( ' Permanent operation ' )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
set_rich_rule_enabled_permanent ( zone , rich_rule )
changed = True
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
set_rich_rule_disabled_permanent ( zone , rich_rule )
changed = True
2014-09-27 02:50:10 +02:00
if immediate or not permanent :
2013-10-10 15:09:52 +02:00
is_enabled = get_rich_rule_enabled ( zone , rich_rule )
msgs . append ( ' Non-permanent operation ' )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
set_rich_rule_enabled ( zone , rich_rule , timeout )
changed = True
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
set_rich_rule_disabled ( zone , rich_rule )
changed = True
if changed == True :
msgs . append ( " Changed rich_rule %s to %s " % ( rich_rule , desired_state ) )
2016-01-10 23:18:09 +01:00
if interface != None :
2016-05-02 17:16:07 +02:00
if permanent :
is_enabled = get_interface_permanent ( zone , interface )
msgs . append ( ' Permanent operation ' )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
2016-01-10 23:18:09 +01:00
2016-05-02 17:16:07 +02:00
change_zone_of_interface_permanent ( zone , interface )
changed = True
msgs . append ( " Changed %s to zone %s " % ( interface , zone ) )
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
2016-01-10 23:18:09 +01:00
2016-05-02 17:16:07 +02:00
remove_interface_permanent ( zone , interface )
changed = True
msgs . append ( " Removed %s from zone %s " % ( interface , zone ) )
if immediate or not permanent :
is_enabled = get_interface ( zone , interface )
msgs . append ( ' Non-permanent operation ' )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
change_zone_of_interface ( zone , interface )
changed = True
msgs . append ( " Changed %s to zone %s " % ( interface , zone ) )
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
remove_interface ( zone , interface )
changed = True
msgs . append ( " Removed %s from zone %s " % ( interface , zone ) )
2016-01-10 23:18:09 +01:00
2016-04-16 14:15:00 +02:00
if masquerade != None :
if permanent :
is_enabled = get_masquerade_enabled_permanent ( zone )
msgs . append ( ' Permanent operation ' )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
set_masquerade_permanent ( zone , True )
changed = True
msgs . append ( " Added masquerade to zone %s " % ( zone ) )
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
set_masquerade_permanent ( zone , False )
changed = True
msgs . append ( " Removed masquerade from zone %s " % ( zone ) )
if immediate or not permanent :
is_enabled = get_masquerade_enabled ( zone )
msgs . append ( ' Non-permanent operation ' )
if desired_state == " enabled " :
if is_enabled == False :
if module . check_mode :
module . exit_json ( changed = True )
set_masquerade_enabled ( zone )
changed = True
msgs . append ( " Added masquerade to zone %s " % ( zone ) )
elif desired_state == " disabled " :
if is_enabled == True :
if module . check_mode :
module . exit_json ( changed = True )
set_masquerade_disabled ( zone )
changed = True
msgs . append ( " Removed masquerade from zone %s " % ( zone ) )
2013-08-13 16:27:45 +02:00
module . exit_json ( changed = changed , msg = ' , ' . join ( msgs ) )
#################################################
2013-12-02 21:11:23 +01:00
# import module snippets
from ansible . module_utils . basic import *
2013-08-13 16:27:45 +02:00
main ( )