cloudstack: cs_firewall: add account and domain

reviewable/pr18780/r1
Rene Moser 10 years ago
parent 8476fe1d72
commit 5bc3ae040d

@ -68,9 +68,19 @@ options:
- Error code for this icmp message. Considered if C(protocol=icmp). - Error code for this icmp message. Considered if C(protocol=icmp).
required: false required: false
default: null default: null
domain:
description:
- Domain the firewall rule is related to.
required: false
default: null
account:
description:
- Account the firewall rule is related to.
required: false
default: null
project: project:
description: description:
- Name of the project. - Name of the project the firewall rule is related to.
required: false required: false
default: null default: null
extends_documentation_fragment: cloudstack extends_documentation_fragment: cloudstack
@ -149,8 +159,10 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack):
self.module.fail_json(msg="no icmp_type set") self.module.fail_json(msg="no icmp_type set")
args = {} args = {}
args['ipaddressid'] = self.get_ip_address_id() args['ipaddressid'] = self.get_ip_address('id')
args['projectid'] = self.get_project_id() args['account'] = self.get_account('name')
args['domainid'] = self.get_domain('id')
args['projectid'] = self.get_project('id')
firewall_rules = self.cs.listFirewallRules(**args) firewall_rules = self.cs.listFirewallRules(**args)
if firewall_rules and 'firewallrule' in firewall_rules: if firewall_rules and 'firewallrule' in firewall_rules:
@ -195,7 +207,8 @@ class AnsibleCloudStackFirewall(AnsibleCloudStack):
args['endport'] = self.get_end_port() args['endport'] = self.get_end_port()
args['icmptype'] = self.module.params.get('icmp_type') args['icmptype'] = self.module.params.get('icmp_type')
args['icmpcode'] = self.module.params.get('icmp_code') args['icmpcode'] = self.module.params.get('icmp_code')
args['ipaddressid'] = self.get_ip_address_id() args['ipaddressid'] = self.get_ip_address('id')
if not self.module.check_mode: if not self.module.check_mode:
firewall_rule = self.cs.createFirewallRule(**args) firewall_rule = self.cs.createFirewallRule(**args)
@ -231,6 +244,8 @@ def main():
start_port = dict(type='int', aliases=['port'], default=None), start_port = dict(type='int', aliases=['port'], default=None),
end_port = dict(type='int', default=None), end_port = dict(type='int', default=None),
state = dict(choices=['present', 'absent'], default='present'), state = dict(choices=['present', 'absent'], default='present'),
domain = dict(default=None),
account = dict(default=None),
project = dict(default=None), project = dict(default=None),
api_key = dict(default=None), api_key = dict(default=None),
api_secret = dict(default=None), api_secret = dict(default=None),

Loading…
Cancel
Save