|
|
@ -45,6 +45,20 @@ options:
|
|
|
|
default: 'present'
|
|
|
|
default: 'present'
|
|
|
|
choices: [ "present", "absent" ]
|
|
|
|
choices: [ "present", "absent" ]
|
|
|
|
aliases: []
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
purge_rules:
|
|
|
|
|
|
|
|
version_added: "1.7"
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Purge existing rules on security group that are not found in rules
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: 'true'
|
|
|
|
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
purge_rules_egress:
|
|
|
|
|
|
|
|
version_added: "1.7"
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Purge existing rules_egree on security group that are not found in rules_egress
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: 'true'
|
|
|
|
|
|
|
|
aliases: []
|
|
|
|
|
|
|
|
|
|
|
|
extends_documentation_fragment: aws
|
|
|
|
extends_documentation_fragment: aws
|
|
|
|
|
|
|
|
|
|
|
@ -164,6 +178,9 @@ def main():
|
|
|
|
rules=dict(),
|
|
|
|
rules=dict(),
|
|
|
|
rules_egress=dict(),
|
|
|
|
rules_egress=dict(),
|
|
|
|
state = dict(default='present', choices=['present', 'absent']),
|
|
|
|
state = dict(default='present', choices=['present', 'absent']),
|
|
|
|
|
|
|
|
purge_rules=dict(default=True, required=False, type='bool'),
|
|
|
|
|
|
|
|
purge_rules_egress=dict(default=True, required=False, type='bool'),
|
|
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
module = AnsibleModule(
|
|
|
|
module = AnsibleModule(
|
|
|
@ -177,6 +194,8 @@ def main():
|
|
|
|
rules = module.params['rules']
|
|
|
|
rules = module.params['rules']
|
|
|
|
rules_egress = module.params['rules_egress']
|
|
|
|
rules_egress = module.params['rules_egress']
|
|
|
|
state = module.params.get('state')
|
|
|
|
state = module.params.get('state')
|
|
|
|
|
|
|
|
purge_rules = module.params['purge_rules']
|
|
|
|
|
|
|
|
purge_rules_egress = module.params['purge_rules_egress']
|
|
|
|
|
|
|
|
|
|
|
|
changed = False
|
|
|
|
changed = False
|
|
|
|
|
|
|
|
|
|
|
@ -274,6 +293,7 @@ def main():
|
|
|
|
changed = True
|
|
|
|
changed = True
|
|
|
|
|
|
|
|
|
|
|
|
# Finally, remove anything left in the groupRules -- these will be defunct rules
|
|
|
|
# Finally, remove anything left in the groupRules -- these will be defunct rules
|
|
|
|
|
|
|
|
if purge_rules:
|
|
|
|
for rule in groupRules.itervalues() :
|
|
|
|
for rule in groupRules.itervalues() :
|
|
|
|
for grant in rule.grants:
|
|
|
|
for grant in rule.grants:
|
|
|
|
grantGroup = None
|
|
|
|
grantGroup = None
|
|
|
@ -338,6 +358,7 @@ def main():
|
|
|
|
del groupRules[default_egress_rule]
|
|
|
|
del groupRules[default_egress_rule]
|
|
|
|
|
|
|
|
|
|
|
|
# Finally, remove anything left in the groupRules -- these will be defunct rules
|
|
|
|
# Finally, remove anything left in the groupRules -- these will be defunct rules
|
|
|
|
|
|
|
|
if purge_rules_egress:
|
|
|
|
for rule in groupRules.itervalues():
|
|
|
|
for rule in groupRules.itervalues():
|
|
|
|
for grant in rule.grants:
|
|
|
|
for grant in rule.grants:
|
|
|
|
grantGroup = None
|
|
|
|
grantGroup = None
|
|
|
|