# 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 <http://www.gnu.org/licenses/>.
DOCUMENTATION = '''
---
module: bigip_pool
short_description: "Manages F5 BIG-IP LTM pool members"
description:
- "Manages F5 BIG-IP LTM pool members via iControl SOAP API"
version_added: "1.2"
author: Matt Hite
notes:
- "Requires BIG-IP software version >= 11"
- "F5 developed module 'bigsuds' required (see http://devcentral.f5.com)"
- "Best run as a local_action in your playbook"
- "If pool member IP address is no longer referenced by another pool when running with state=absent, the node IP will also be deleted from the F5 configuration."
requirements:
- bigsuds
options:
server:
description:
- "BIG-IP host"
required: true
default: null
choices: []
aliases: []
user:
description:
- "BIG-IP username"
required: true
default: null
choices: []
aliases: []
password:
description:
- "BIG-IP password"
required: true
default: null
choices: []
aliases: []
state:
description:
- "Pool member state"
required: false
default: present
choices: ['present', 'absent']
aliases: []
name:
description:
- "BIG-IP pool name"
required: true
default: null
choices: []
aliases: ['pool']
partition:
description:
- "BIG-IP partition"
required: false
default: 'Common'
choices: []
aliases: []
host:
description:
- "BIG-IP pool member"
required: true
default: null
choices: []
aliases: []
port:
description:
- "BIG-IP pool member port"
required: true
default: null
choices: []
aliases: []
'''
EXAMPLES = '''
### Examples assume [localhost] is defined in inventory file
## ad-hoc ansible CLI example
# ensures 1.1.1.1:80 is present in pool /matthite/matthite-pool on load balancer lb.mydomain.com
ansible -c local localhost -m bigip_pool -a "server=lb.mydomain.com user=admin password=mysecret state=present name=matthite-pool partition=matthite host=1.1.1.1 port=80"
# ensures 1.1.1.1:80 is absent from pool /matthite/matthite-pool on load balancer lb.mydomain.com
ansible -c local localhost -m bigip_pool -a "server=lb.mydomain.com user=admin password=mysecret state=absent name=matthite-pool partition=matthite host=1.1.1.1 port=80"
## playbook task example:
---
# file bigip-test.yml
# ...
tasks:
- name: Register current node to load balancer pool