|
|
@ -67,8 +67,8 @@ options:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
default: 0
|
|
|
|
default: 0
|
|
|
|
notes:
|
|
|
|
notes:
|
|
|
|
- Not tested on any debian based system.
|
|
|
|
- Not tested on any Debian based system.
|
|
|
|
requirements: [ firewalld >= 0.2.11 ]
|
|
|
|
requirements: [ 'firewalld >= 0.2.11' ]
|
|
|
|
author: '"Adam Miller (@maxamillion)" <maxamillion@fedoraproject.org>'
|
|
|
|
author: '"Adam Miller (@maxamillion)" <maxamillion@fedoraproject.org>'
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
|
|
|
|
|
|
|
@ -82,7 +82,6 @@ EXAMPLES = '''
|
|
|
|
|
|
|
|
|
|
|
|
import os
|
|
|
|
import os
|
|
|
|
import re
|
|
|
|
import re
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
import firewall.config
|
|
|
|
import firewall.config
|
|
|
@ -90,14 +89,9 @@ try:
|
|
|
|
|
|
|
|
|
|
|
|
from firewall.client import FirewallClient
|
|
|
|
from firewall.client import FirewallClient
|
|
|
|
fw = FirewallClient()
|
|
|
|
fw = FirewallClient()
|
|
|
|
if not fw.connected:
|
|
|
|
HAS_FIREWALLD = True
|
|
|
|
raise Exception('failed to connect to the firewalld daemon')
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
except ImportError:
|
|
|
|
print "failed=True msg='firewalld required for this module'"
|
|
|
|
HAS_FIREWALLD = False
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
except Exception, e:
|
|
|
|
|
|
|
|
print "failed=True msg='%s'" % str(e)
|
|
|
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
################
|
|
|
|
################
|
|
|
|
# port handling
|
|
|
|
# port handling
|
|
|
@ -223,6 +217,9 @@ def main():
|
|
|
|
supports_check_mode=True
|
|
|
|
supports_check_mode=True
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not HAS_FIREWALLD:
|
|
|
|
|
|
|
|
module.fail_json(msg='firewalld required for this module')
|
|
|
|
|
|
|
|
|
|
|
|
## Pre-run version checking
|
|
|
|
## Pre-run version checking
|
|
|
|
if FW_VERSION < "0.2.11":
|
|
|
|
if FW_VERSION < "0.2.11":
|
|
|
|
module.fail_json(msg='unsupported version of firewalld, requires >= 2.0.11')
|
|
|
|
module.fail_json(msg='unsupported version of firewalld, requires >= 2.0.11')
|
|
|
@ -400,6 +397,4 @@ def main():
|
|
|
|
#################################################
|
|
|
|
#################################################
|
|
|
|
# import module snippets
|
|
|
|
# import module snippets
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
|
|
|
|
|
|
|
|
main()
|
|
|
|
main()
|
|
|
|
|
|
|
|
|
|
|
|