diff --git a/lib/ansible/modules/cloud/cloudstack/cs_loadbalancer_rule_member.py b/lib/ansible/modules/cloud/cloudstack/cs_loadbalancer_rule_member.py index b19ad2021ed..ccbacbc9fea 100644 --- a/lib/ansible/modules/cloud/cloudstack/cs_loadbalancer_rule_member.py +++ b/lib/ansible/modules/cloud/cloudstack/cs_loadbalancer_rule_member.py @@ -1,23 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- # -# (c) 2015, Darren Worrall -# (c) 2015, René Moser -# -# 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 . +# Copyright (c) 2015, Darren Worrall +# Copyright (c) 2015, René Moser +# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['stableinterface'], @@ -67,20 +53,25 @@ options: description: - Name of the zone in which the rule should be located. - If not set, default zone is used. + poll_async: + description: + - Poll async jobs until job has finished. + type: bool + default: yes extends_documentation_fragment: cloudstack ''' EXAMPLES = ''' -# Add VMs to an existing load balancer -- local_action: +- name: Add VMs to an existing load balancer + local_action: module: cs_loadbalancer_rule_member name: balance_http vms: - web01 - web02 -# Remove a VM from an existing load balancer -- local_action: +- name: Remove a VM from an existing load balancer + local_action: module: cs_loadbalancer_rule_member name: balance_http vms: @@ -259,10 +250,10 @@ class AnsibleCloudStackLBRuleMember(AnsibleCloudStack): wanted_names = self.module.params.get('vms') if operation == 'add': - cs_func = self.cs.assignToLoadBalancerRule + cs_func = 'assignToLoadBalancerRule' to_change = set(wanted_names) - set(existing.keys()) else: - cs_func = self.cs.removeFromLoadBalancerRule + cs_func = 'removeFromLoadBalancerRule' to_change = set(wanted_names) & set(existing.keys()) if not to_change: @@ -284,7 +275,8 @@ class AnsibleCloudStackLBRuleMember(AnsibleCloudStack): self.result['changed'] = True if to_change_ids and not self.module.check_mode: - res = cs_func( + res = self.query_api( + cs_func, id=rule['id'], virtualmachineids=to_change_ids, ) diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 1400b25dace..ef550bb4df2 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -154,9 +154,6 @@ lib/ansible/modules/cloud/cloudstack/cs_iso.py E325 lib/ansible/modules/cloud/cloudstack/cs_loadbalancer_rule.py E322 lib/ansible/modules/cloud/cloudstack/cs_loadbalancer_rule.py E324 lib/ansible/modules/cloud/cloudstack/cs_loadbalancer_rule.py E325 -lib/ansible/modules/cloud/cloudstack/cs_loadbalancer_rule_member.py E322 -lib/ansible/modules/cloud/cloudstack/cs_loadbalancer_rule_member.py E324 -lib/ansible/modules/cloud/cloudstack/cs_loadbalancer_rule_member.py E325 lib/ansible/modules/cloud/cloudstack/cs_network.py E324 lib/ansible/modules/cloud/cloudstack/cs_network_acl_rule.py E324 lib/ansible/modules/cloud/cloudstack/cs_network_acl_rule.py E326