1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py

312 lines
11 KiB
Python
Raw Normal View History

2020-03-09 10:11:07 +01:00
#!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
---
module: ovh_ip_loadbalancing_backend
short_description: Manage OVH IP LoadBalancing backends
description:
- Manage OVH (French European hosting provider) LoadBalancing IP backends
author: Pascal Heraud (@pascalheraud)
notes:
- Uses the python OVH Api U(https://github.com/ovh/python-ovh).
You have to create an application (a key and secret) with a consumer
key as described into U(https://docs.ovh.com/gb/en/customer/first-steps-with-ovh-api/)
requirements:
- ovh > 0.3.5
options:
name:
required: true
description:
- Name of the LoadBalancing internal name (ip-X.X.X.X)
Tidy up validate-modules ignores for some cloud/ modules (#1354) (#1356) * fixed validation-modules for plugins/modules/cloud/atomic/atomic_container.py * fixed validation-modules for plugins/modules/cloud/oracle/oci_vcn.py * fixed validation-modules for plugins/modules/cloud/heroku/heroku_collaborator.py * fixed validation-modules for plugins/modules/cloud/docker/docker_stack.py * fixed validation-modules for plugins/modules/cloud/pubnub/pubnub_blocks.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_ecs_instance.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_port.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_subnet.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_failover.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py * fixed validation-modules for plugins/modules/cloud/softlayer/sl_vm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_kvm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_template.py * fixed validation-modules for plugins/modules/cloud/misc/terraform.py * fixed validation-modules for plugins/modules/cloud/memset/memset_dns_reload.py * fixed validation-modules for plugins/modules/cloud/memset/memset_memstore_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_server_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_domain.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_record.py * fixed validation-modules for plugins/modules/cloud/linode/linode.py * fixed validation-modules for plugins/modules/cloud/linode/linode_v4.py * fixed validation-modules for plugins/doc_fragments/dimensiondata.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_network.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_vlan.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_info.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_powerstate.py * Tidy up validate-modules ignores for varied cloud modules - loking at the count of ignore lines, worked from the lower numbers up * rolled back line for docker_container, removed two extraneous for xenserver * rolled back lins for linode in 2.9 (cherry picked from commit 3d1f9ed657e5b872f9f6080776498f54e416b02a) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2020-11-23 10:01:35 +01:00
type: str
2020-03-09 10:11:07 +01:00
backend:
required: true
description:
- The IP address of the backend to update / modify / delete
Tidy up validate-modules ignores for some cloud/ modules (#1354) (#1356) * fixed validation-modules for plugins/modules/cloud/atomic/atomic_container.py * fixed validation-modules for plugins/modules/cloud/oracle/oci_vcn.py * fixed validation-modules for plugins/modules/cloud/heroku/heroku_collaborator.py * fixed validation-modules for plugins/modules/cloud/docker/docker_stack.py * fixed validation-modules for plugins/modules/cloud/pubnub/pubnub_blocks.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_ecs_instance.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_port.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_subnet.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_failover.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py * fixed validation-modules for plugins/modules/cloud/softlayer/sl_vm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_kvm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_template.py * fixed validation-modules for plugins/modules/cloud/misc/terraform.py * fixed validation-modules for plugins/modules/cloud/memset/memset_dns_reload.py * fixed validation-modules for plugins/modules/cloud/memset/memset_memstore_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_server_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_domain.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_record.py * fixed validation-modules for plugins/modules/cloud/linode/linode.py * fixed validation-modules for plugins/modules/cloud/linode/linode_v4.py * fixed validation-modules for plugins/doc_fragments/dimensiondata.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_network.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_vlan.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_info.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_powerstate.py * Tidy up validate-modules ignores for varied cloud modules - loking at the count of ignore lines, worked from the lower numbers up * rolled back line for docker_container, removed two extraneous for xenserver * rolled back lins for linode in 2.9 (cherry picked from commit 3d1f9ed657e5b872f9f6080776498f54e416b02a) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2020-11-23 10:01:35 +01:00
type: str
2020-03-09 10:11:07 +01:00
state:
default: present
choices: ['present', 'absent']
description:
- Determines whether the backend is to be created/modified
or deleted
Tidy up validate-modules ignores for some cloud/ modules (#1354) (#1356) * fixed validation-modules for plugins/modules/cloud/atomic/atomic_container.py * fixed validation-modules for plugins/modules/cloud/oracle/oci_vcn.py * fixed validation-modules for plugins/modules/cloud/heroku/heroku_collaborator.py * fixed validation-modules for plugins/modules/cloud/docker/docker_stack.py * fixed validation-modules for plugins/modules/cloud/pubnub/pubnub_blocks.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_ecs_instance.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_port.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_subnet.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_failover.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py * fixed validation-modules for plugins/modules/cloud/softlayer/sl_vm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_kvm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_template.py * fixed validation-modules for plugins/modules/cloud/misc/terraform.py * fixed validation-modules for plugins/modules/cloud/memset/memset_dns_reload.py * fixed validation-modules for plugins/modules/cloud/memset/memset_memstore_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_server_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_domain.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_record.py * fixed validation-modules for plugins/modules/cloud/linode/linode.py * fixed validation-modules for plugins/modules/cloud/linode/linode_v4.py * fixed validation-modules for plugins/doc_fragments/dimensiondata.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_network.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_vlan.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_info.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_powerstate.py * Tidy up validate-modules ignores for varied cloud modules - loking at the count of ignore lines, worked from the lower numbers up * rolled back line for docker_container, removed two extraneous for xenserver * rolled back lins for linode in 2.9 (cherry picked from commit 3d1f9ed657e5b872f9f6080776498f54e416b02a) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2020-11-23 10:01:35 +01:00
type: str
2020-03-09 10:11:07 +01:00
probe:
default: 'none'
choices: ['none', 'http', 'icmp' , 'oco']
description:
- Determines the type of probe to use for this backend
Tidy up validate-modules ignores for some cloud/ modules (#1354) (#1356) * fixed validation-modules for plugins/modules/cloud/atomic/atomic_container.py * fixed validation-modules for plugins/modules/cloud/oracle/oci_vcn.py * fixed validation-modules for plugins/modules/cloud/heroku/heroku_collaborator.py * fixed validation-modules for plugins/modules/cloud/docker/docker_stack.py * fixed validation-modules for plugins/modules/cloud/pubnub/pubnub_blocks.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_ecs_instance.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_port.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_subnet.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_failover.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py * fixed validation-modules for plugins/modules/cloud/softlayer/sl_vm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_kvm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_template.py * fixed validation-modules for plugins/modules/cloud/misc/terraform.py * fixed validation-modules for plugins/modules/cloud/memset/memset_dns_reload.py * fixed validation-modules for plugins/modules/cloud/memset/memset_memstore_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_server_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_domain.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_record.py * fixed validation-modules for plugins/modules/cloud/linode/linode.py * fixed validation-modules for plugins/modules/cloud/linode/linode_v4.py * fixed validation-modules for plugins/doc_fragments/dimensiondata.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_network.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_vlan.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_info.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_powerstate.py * Tidy up validate-modules ignores for varied cloud modules - loking at the count of ignore lines, worked from the lower numbers up * rolled back line for docker_container, removed two extraneous for xenserver * rolled back lins for linode in 2.9 (cherry picked from commit 3d1f9ed657e5b872f9f6080776498f54e416b02a) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2020-11-23 10:01:35 +01:00
type: str
2020-03-09 10:11:07 +01:00
weight:
default: 8
description:
- Determines the weight for this backend
Tidy up validate-modules ignores for some cloud/ modules (#1354) (#1356) * fixed validation-modules for plugins/modules/cloud/atomic/atomic_container.py * fixed validation-modules for plugins/modules/cloud/oracle/oci_vcn.py * fixed validation-modules for plugins/modules/cloud/heroku/heroku_collaborator.py * fixed validation-modules for plugins/modules/cloud/docker/docker_stack.py * fixed validation-modules for plugins/modules/cloud/pubnub/pubnub_blocks.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_ecs_instance.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_port.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_subnet.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_failover.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py * fixed validation-modules for plugins/modules/cloud/softlayer/sl_vm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_kvm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_template.py * fixed validation-modules for plugins/modules/cloud/misc/terraform.py * fixed validation-modules for plugins/modules/cloud/memset/memset_dns_reload.py * fixed validation-modules for plugins/modules/cloud/memset/memset_memstore_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_server_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_domain.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_record.py * fixed validation-modules for plugins/modules/cloud/linode/linode.py * fixed validation-modules for plugins/modules/cloud/linode/linode_v4.py * fixed validation-modules for plugins/doc_fragments/dimensiondata.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_network.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_vlan.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_info.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_powerstate.py * Tidy up validate-modules ignores for varied cloud modules - loking at the count of ignore lines, worked from the lower numbers up * rolled back line for docker_container, removed two extraneous for xenserver * rolled back lins for linode in 2.9 (cherry picked from commit 3d1f9ed657e5b872f9f6080776498f54e416b02a) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2020-11-23 10:01:35 +01:00
type: int
2020-03-09 10:11:07 +01:00
endpoint:
required: true
description:
- The endpoint to use ( for instance ovh-eu)
Tidy up validate-modules ignores for some cloud/ modules (#1354) (#1356) * fixed validation-modules for plugins/modules/cloud/atomic/atomic_container.py * fixed validation-modules for plugins/modules/cloud/oracle/oci_vcn.py * fixed validation-modules for plugins/modules/cloud/heroku/heroku_collaborator.py * fixed validation-modules for plugins/modules/cloud/docker/docker_stack.py * fixed validation-modules for plugins/modules/cloud/pubnub/pubnub_blocks.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_ecs_instance.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_port.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_subnet.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_failover.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py * fixed validation-modules for plugins/modules/cloud/softlayer/sl_vm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_kvm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_template.py * fixed validation-modules for plugins/modules/cloud/misc/terraform.py * fixed validation-modules for plugins/modules/cloud/memset/memset_dns_reload.py * fixed validation-modules for plugins/modules/cloud/memset/memset_memstore_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_server_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_domain.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_record.py * fixed validation-modules for plugins/modules/cloud/linode/linode.py * fixed validation-modules for plugins/modules/cloud/linode/linode_v4.py * fixed validation-modules for plugins/doc_fragments/dimensiondata.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_network.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_vlan.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_info.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_powerstate.py * Tidy up validate-modules ignores for varied cloud modules - loking at the count of ignore lines, worked from the lower numbers up * rolled back line for docker_container, removed two extraneous for xenserver * rolled back lins for linode in 2.9 (cherry picked from commit 3d1f9ed657e5b872f9f6080776498f54e416b02a) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2020-11-23 10:01:35 +01:00
type: str
2020-03-09 10:11:07 +01:00
application_key:
required: true
description:
- The applicationKey to use
Tidy up validate-modules ignores for some cloud/ modules (#1354) (#1356) * fixed validation-modules for plugins/modules/cloud/atomic/atomic_container.py * fixed validation-modules for plugins/modules/cloud/oracle/oci_vcn.py * fixed validation-modules for plugins/modules/cloud/heroku/heroku_collaborator.py * fixed validation-modules for plugins/modules/cloud/docker/docker_stack.py * fixed validation-modules for plugins/modules/cloud/pubnub/pubnub_blocks.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_ecs_instance.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_port.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_subnet.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_failover.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py * fixed validation-modules for plugins/modules/cloud/softlayer/sl_vm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_kvm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_template.py * fixed validation-modules for plugins/modules/cloud/misc/terraform.py * fixed validation-modules for plugins/modules/cloud/memset/memset_dns_reload.py * fixed validation-modules for plugins/modules/cloud/memset/memset_memstore_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_server_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_domain.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_record.py * fixed validation-modules for plugins/modules/cloud/linode/linode.py * fixed validation-modules for plugins/modules/cloud/linode/linode_v4.py * fixed validation-modules for plugins/doc_fragments/dimensiondata.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_network.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_vlan.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_info.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_powerstate.py * Tidy up validate-modules ignores for varied cloud modules - loking at the count of ignore lines, worked from the lower numbers up * rolled back line for docker_container, removed two extraneous for xenserver * rolled back lins for linode in 2.9 (cherry picked from commit 3d1f9ed657e5b872f9f6080776498f54e416b02a) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2020-11-23 10:01:35 +01:00
type: str
2020-03-09 10:11:07 +01:00
application_secret:
required: true
description:
- The application secret to use
Tidy up validate-modules ignores for some cloud/ modules (#1354) (#1356) * fixed validation-modules for plugins/modules/cloud/atomic/atomic_container.py * fixed validation-modules for plugins/modules/cloud/oracle/oci_vcn.py * fixed validation-modules for plugins/modules/cloud/heroku/heroku_collaborator.py * fixed validation-modules for plugins/modules/cloud/docker/docker_stack.py * fixed validation-modules for plugins/modules/cloud/pubnub/pubnub_blocks.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_ecs_instance.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_port.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_subnet.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_failover.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py * fixed validation-modules for plugins/modules/cloud/softlayer/sl_vm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_kvm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_template.py * fixed validation-modules for plugins/modules/cloud/misc/terraform.py * fixed validation-modules for plugins/modules/cloud/memset/memset_dns_reload.py * fixed validation-modules for plugins/modules/cloud/memset/memset_memstore_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_server_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_domain.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_record.py * fixed validation-modules for plugins/modules/cloud/linode/linode.py * fixed validation-modules for plugins/modules/cloud/linode/linode_v4.py * fixed validation-modules for plugins/doc_fragments/dimensiondata.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_network.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_vlan.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_info.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_powerstate.py * Tidy up validate-modules ignores for varied cloud modules - loking at the count of ignore lines, worked from the lower numbers up * rolled back line for docker_container, removed two extraneous for xenserver * rolled back lins for linode in 2.9 (cherry picked from commit 3d1f9ed657e5b872f9f6080776498f54e416b02a) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2020-11-23 10:01:35 +01:00
type: str
2020-03-09 10:11:07 +01:00
consumer_key:
required: true
description:
- The consumer key to use
Tidy up validate-modules ignores for some cloud/ modules (#1354) (#1356) * fixed validation-modules for plugins/modules/cloud/atomic/atomic_container.py * fixed validation-modules for plugins/modules/cloud/oracle/oci_vcn.py * fixed validation-modules for plugins/modules/cloud/heroku/heroku_collaborator.py * fixed validation-modules for plugins/modules/cloud/docker/docker_stack.py * fixed validation-modules for plugins/modules/cloud/pubnub/pubnub_blocks.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_ecs_instance.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_port.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_subnet.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_failover.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py * fixed validation-modules for plugins/modules/cloud/softlayer/sl_vm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_kvm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_template.py * fixed validation-modules for plugins/modules/cloud/misc/terraform.py * fixed validation-modules for plugins/modules/cloud/memset/memset_dns_reload.py * fixed validation-modules for plugins/modules/cloud/memset/memset_memstore_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_server_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_domain.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_record.py * fixed validation-modules for plugins/modules/cloud/linode/linode.py * fixed validation-modules for plugins/modules/cloud/linode/linode_v4.py * fixed validation-modules for plugins/doc_fragments/dimensiondata.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_network.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_vlan.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_info.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_powerstate.py * Tidy up validate-modules ignores for varied cloud modules - loking at the count of ignore lines, worked from the lower numbers up * rolled back line for docker_container, removed two extraneous for xenserver * rolled back lins for linode in 2.9 (cherry picked from commit 3d1f9ed657e5b872f9f6080776498f54e416b02a) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2020-11-23 10:01:35 +01:00
type: str
2020-03-09 10:11:07 +01:00
timeout:
default: 120
description:
- The timeout in seconds used to wait for a task to be
completed.
Tidy up validate-modules ignores for some cloud/ modules (#1354) (#1356) * fixed validation-modules for plugins/modules/cloud/atomic/atomic_container.py * fixed validation-modules for plugins/modules/cloud/oracle/oci_vcn.py * fixed validation-modules for plugins/modules/cloud/heroku/heroku_collaborator.py * fixed validation-modules for plugins/modules/cloud/docker/docker_stack.py * fixed validation-modules for plugins/modules/cloud/pubnub/pubnub_blocks.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_ecs_instance.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_port.py * fixed validation-modules for plugins/modules/cloud/huawei/hwc_vpc_subnet.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_failover.py * fixed validation-modules for plugins/modules/cloud/ovh/ovh_ip_loadbalancing_backend.py * fixed validation-modules for plugins/modules/cloud/softlayer/sl_vm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_kvm.py * fixed validation-modules for plugins/modules/cloud/misc/proxmox_template.py * fixed validation-modules for plugins/modules/cloud/misc/terraform.py * fixed validation-modules for plugins/modules/cloud/memset/memset_dns_reload.py * fixed validation-modules for plugins/modules/cloud/memset/memset_memstore_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_server_info.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_domain.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone.py * fixed validation-modules for plugins/modules/cloud/memset/memset_zone_record.py * fixed validation-modules for plugins/modules/cloud/linode/linode.py * fixed validation-modules for plugins/modules/cloud/linode/linode_v4.py * fixed validation-modules for plugins/doc_fragments/dimensiondata.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_network.py * fixed validation-modules for plugins/modules/cloud/dimensiondata/dimensiondata_vlan.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_info.py * fixed validation-modules for plugins/modules/cloud/xenserver/xenserver_guest_powerstate.py * Tidy up validate-modules ignores for varied cloud modules - loking at the count of ignore lines, worked from the lower numbers up * rolled back line for docker_container, removed two extraneous for xenserver * rolled back lins for linode in 2.9 (cherry picked from commit 3d1f9ed657e5b872f9f6080776498f54e416b02a) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2020-11-23 10:01:35 +01:00
type: int
2020-03-09 10:11:07 +01:00
'''
EXAMPLES = '''
- name: Adds or modify the backend '212.1.1.1' to a loadbalancing 'ip-1.1.1.1'
ovh_ip_loadbalancing:
2020-03-09 10:11:07 +01:00
name: ip-1.1.1.1
backend: 212.1.1.1
state: present
probe: none
weight: 8
endpoint: ovh-eu
application_key: yourkey
application_secret: yoursecret
consumer_key: yourconsumerkey
- name: Removes a backend '212.1.1.1' from a loadbalancing 'ip-1.1.1.1'
ovh_ip_loadbalancing:
2020-03-09 10:11:07 +01:00
name: ip-1.1.1.1
backend: 212.1.1.1
state: absent
endpoint: ovh-eu
application_key: yourkey
application_secret: yoursecret
consumer_key: yourconsumerkey
'''
RETURN = '''
'''
import time
try:
import ovh
import ovh.exceptions
from ovh.exceptions import APIError
HAS_OVH = True
except ImportError:
HAS_OVH = False
from ansible.module_utils.basic import AnsibleModule
def getOvhClient(ansibleModule):
endpoint = ansibleModule.params.get('endpoint')
application_key = ansibleModule.params.get('application_key')
application_secret = ansibleModule.params.get('application_secret')
consumer_key = ansibleModule.params.get('consumer_key')
return ovh.Client(
endpoint=endpoint,
application_key=application_key,
application_secret=application_secret,
consumer_key=consumer_key
)
def waitForNoTask(client, name, timeout):
currentTimeout = timeout
while len(client.get('/ip/loadBalancing/{0}/task'.format(name))) > 0:
time.sleep(1) # Delay for 1 sec
currentTimeout -= 1
if currentTimeout < 0:
return False
return True
def main():
module = AnsibleModule(
argument_spec=dict(
name=dict(required=True),
backend=dict(required=True),
weight=dict(default=8, type='int'),
probe=dict(default='none',
choices=['none', 'http', 'icmp', 'oco']),
state=dict(default='present', choices=['present', 'absent']),
endpoint=dict(required=True),
application_key=dict(required=True, no_log=True),
application_secret=dict(required=True, no_log=True),
consumer_key=dict(required=True, no_log=True),
timeout=dict(default=120, type='int')
)
)
if not HAS_OVH:
module.fail_json(msg='ovh-api python module'
'is required to run this module ')
# Get parameters
name = module.params.get('name')
state = module.params.get('state')
backend = module.params.get('backend')
weight = module.params.get('weight')
probe = module.params.get('probe')
timeout = module.params.get('timeout')
# Connect to OVH API
client = getOvhClient(module)
# Check that the load balancing exists
try:
loadBalancings = client.get('/ip/loadBalancing')
except APIError as apiError:
module.fail_json(
msg='Unable to call OVH api for getting the list of loadBalancing, '
'check application key, secret, consumerkey and parameters. '
'Error returned by OVH api was : {0}'.format(apiError))
if name not in loadBalancings:
module.fail_json(msg='IP LoadBalancing {0} does not exist'.format(name))
# Check that no task is pending before going on
try:
if not waitForNoTask(client, name, timeout):
module.fail_json(
msg='Timeout of {0} seconds while waiting for no pending '
'tasks before executing the module '.format(timeout))
except APIError as apiError:
module.fail_json(
msg='Unable to call OVH api for getting the list of pending tasks '
'of the loadBalancing, check application key, secret, consumerkey '
'and parameters. Error returned by OVH api was : {0}'
.format(apiError))
try:
backends = client.get('/ip/loadBalancing/{0}/backend'.format(name))
except APIError as apiError:
module.fail_json(
msg='Unable to call OVH api for getting the list of backends '
'of the loadBalancing, check application key, secret, consumerkey '
'and parameters. Error returned by OVH api was : {0}'
.format(apiError))
backendExists = backend in backends
moduleChanged = False
if state == "absent":
if backendExists:
# Remove backend
try:
client.delete(
'/ip/loadBalancing/{0}/backend/{1}'.format(name, backend))
if not waitForNoTask(client, name, timeout):
module.fail_json(
msg='Timeout of {0} seconds while waiting for completion '
'of removing backend task'.format(timeout))
except APIError as apiError:
module.fail_json(
msg='Unable to call OVH api for deleting the backend, '
'check application key, secret, consumerkey and '
'parameters. Error returned by OVH api was : {0}'
.format(apiError))
moduleChanged = True
else:
if backendExists:
# Get properties
try:
backendProperties = client.get(
'/ip/loadBalancing/{0}/backend/{1}'.format(name, backend))
except APIError as apiError:
module.fail_json(
msg='Unable to call OVH api for getting the backend properties, '
'check application key, secret, consumerkey and '
'parameters. Error returned by OVH api was : {0}'
.format(apiError))
if (backendProperties['weight'] != weight):
# Change weight
try:
client.post(
'/ip/loadBalancing/{0}/backend/{1}/setWeight'
.format(name, backend), weight=weight)
if not waitForNoTask(client, name, timeout):
module.fail_json(
msg='Timeout of {0} seconds while waiting for completion '
'of setWeight to backend task'
.format(timeout))
except APIError as apiError:
module.fail_json(
msg='Unable to call OVH api for updating the weight of the '
'backend, check application key, secret, consumerkey '
'and parameters. Error returned by OVH api was : {0}'
.format(apiError))
moduleChanged = True
if (backendProperties['probe'] != probe):
# Change probe
backendProperties['probe'] = probe
try:
client.put(
'/ip/loadBalancing/{0}/backend/{1}'
.format(name, backend), probe=probe)
if not waitForNoTask(client, name, timeout):
module.fail_json(
msg='Timeout of {0} seconds while waiting for completion of '
'setProbe to backend task'
.format(timeout))
except APIError as apiError:
module.fail_json(
msg='Unable to call OVH api for updating the probe of '
'the backend, check application key, secret, '
'consumerkey and parameters. Error returned by OVH api '
'was : {0}'
.format(apiError))
moduleChanged = True
else:
# Creates backend
try:
try:
client.post('/ip/loadBalancing/{0}/backend'.format(name),
ipBackend=backend, probe=probe, weight=weight)
except APIError as apiError:
module.fail_json(
msg='Unable to call OVH api for creating the backend, check '
'application key, secret, consumerkey and parameters. '
'Error returned by OVH api was : {0}'
.format(apiError))
if not waitForNoTask(client, name, timeout):
module.fail_json(
msg='Timeout of {0} seconds while waiting for completion of '
'backend creation task'.format(timeout))
except APIError as apiError:
module.fail_json(
msg='Unable to call OVH api for creating the backend, check '
'application key, secret, consumerkey and parameters. '
'Error returned by OVH api was : {0}'.format(apiError))
moduleChanged = True
module.exit_json(changed=moduleChanged)
if __name__ == '__main__':
main()