Skip to content
Permalink
Browse files

Merge pull request #1523 from wojtek0806/fixes_1430

fixes #1430
  • Loading branch information
wojtek0806 committed Oct 18, 2019
2 parents 87e0260 + a33b7d2 commit ddc8f56444c4d0435407f4ef52cb97f0cc0dec1f
@@ -191,6 +191,8 @@
- List of rules to be applied in priority order.
- If you want to remove existing iRules, specify a single empty value; C("").
See the documentation for an example.
- The order in which iRules are specified matter, so a list that contains same list elements but in different
order in the playbook will make changes on device.
- When C(type) is C(dhcp), this parameter will be ignored.
- When C(type) is C(stateless), this parameter will be ignored.
- When C(type) is C(reject), this parameter will be ignored.
@@ -890,6 +892,7 @@
from library.module_utils.network.f5.common import mark_managed_by
from library.module_utils.network.f5.common import only_has_managed_metadata
from library.module_utils.network.f5.common import flatten_boolean
from library.module_utils.network.f5.common import is_empty_list
from library.module_utils.network.f5.compare import cmp_simple_list
from library.module_utils.network.f5.ipaddress import is_valid_ip
from library.module_utils.network.f5.ipaddress import is_valid_ip_interface
@@ -910,6 +913,7 @@
from ansible_collections.f5networks.f5_modules.plugins.module_utils.common import mark_managed_by
from ansible_collections.f5networks.f5_modules.plugins.module_utils.common import only_has_managed_metadata
from ansible_collections.f5networks.f5_modules.plugins.module_utils.common import flatten_boolean
from ansible_collections.f5networks.f5_modules.plugins.module_utils.common import is_empty_list
from ansible_collections.f5networks.f5_modules.plugins.module_utils.compare import cmp_simple_list
from ansible_collections.f5networks.f5_modules.plugins.module_utils.ipaddress import is_valid_ip
from ansible_collections.f5networks.f5_modules.plugins.module_utils.ipaddress import is_valid_ip_interface
@@ -1921,7 +1925,7 @@ def irules(self):
results = []
if self._values['irules'] is None:
return None
if len(self._values['irules']) == 1 and self._values['irules'][0] == '':
if is_empty_list(self._values['irules']):
return ''
for irule in self._values['irules']:
result = fq_name(self.partition, irule)
@@ -3254,7 +3258,7 @@ def irules(self):
return []
if self.want.irules in [[], ''] and len(self.have.irules) == 0:
return None
if sorted(set(self.want.irules)) != sorted(set(self.have.irules)):
if self.want.irules != self.have.irules:
return self.want.irules

@property
@@ -28,7 +28,7 @@ def upstream(c, collection='f5_modules'):
are available to all modules (such as connection params).
"""
root_dest = '{0}/local/ansible/'.format(BASE_DIR)
root_dest = '{0}/local/ansible_collections/f5networks/{1}/plugins/doc_fragments'.format(BASE_DIR, collection)
if not os.path.exists(root_dest):
print("The specified upstream directory does not exist")
sys.exit(1)
@@ -0,0 +1,189 @@
---
- name: Issue 01430 - Create pool
bigip_pool:
lb_method: round-robin
name: web-pool
state: present
provider: "{{ provider }}"

- name: Issue 01430 - Create iRules
bigip_irule:
content: "when HTTP_REQUEST {HTTP::respond 200 content 'Good Request'}"
module: ltm
name: "{{ item }}"
provider: "{{ provider }}"
loop:
- irule1
- irule2
- irule3
- irule4

- name: Issue 01430 - Create VLANs
bigip_vlan:
name: "{{ item }}"
provider: "{{ provider }}"
loop:
- External
- Internal

- name: Issue 01430 - Add VS on BIG-IP
bigip_virtual_server:
name: httpvs2
destination: 10.168.90.92
port: 80
irules:
- irule1
- irule2
disabled_vlans: Internal
pool: web-pool
snat: automap
profiles: http
provider: "{{ provider }}"
register: result

- name: Issue 01430 - Assert Add VS on BIG-IP
assert:
that:
- result is changed
- result is success

- name: Issue 01430 - Add VS on BIG-IP - Idempotent check
bigip_virtual_server:
name: httpvs2
destination: 10.168.90.92
port: 80
irules:
- irule1
- irule2
disabled_vlans: Internal
pool: web-pool
snat: automap
profiles: http
provider: "{{ provider }}"
register: result

- name: Issue 01430 - Assert Add VS on BIG-IP - Idempotent check
assert:
that:
- result is not changed
- result is success

- name: Issue 01430 - Reorder iRules on VS
bigip_virtual_server:
name: httpvs2
irules:
- irule2
- irule1
provider: "{{ provider }}"
register: result

- name: Issue 01430 - Assert Reorder iRules on VS
assert:
that:
- result is changed
- result is success

- name: Issue 01430 - Reorder iRules on VS - Idempotent check
bigip_virtual_server:
name: httpvs2
irules:
- irule2
- irule1
provider: "{{ provider }}"
register: result

- name: Issue 01430 - Assert Reorder iRules on VS - Idempotent check
assert:
that:
- result is not changed
- result is success

- name: Issue 01430 - Change iRules on VS
bigip_virtual_server:
name: httpvs2
irules:
- irule4
- irule3
provider: "{{ provider }}"
register: result

- name: Issue 01430 - Assert Change iRules on VS
assert:
that:
- result is changed
- result is success

- name: Issue 01430 - Change iRules on VS - Idempotent check
bigip_virtual_server:
name: httpvs2
irules:
- irule4
- irule3
provider: "{{ provider }}"
register: result

- name: Issue 01430 - Assert Change iRules on VS - Idempotent check
assert:
that:
- result is not changed
- result is success

- name: Issue 01430 - Remove iRules from VS
bigip_virtual_server:
name: httpvs2
irules: ""
provider: "{{ provider }}"
register: result

- name: Issue 01430 - Assert Remove iRules from VS
assert:
that:
- result is changed
- result is success

- name: Issue 01430 - Remove iRules from VS - Idempotent check
bigip_virtual_server:
name: httpvs2
irules: ""
provider: "{{ provider }}"
register: result

- name: Issue 01430 - Assert Remove iRules from VS - Idempotent check
assert:
that:
- result is not changed
- result is success

- name: Issue 01430 - Remove VS
bigip_virtual_server:
name: httpvs2
state: absent
provider: "{{ provider }}"

- name: Issue 01430 - Remove VLANs
bigip_vlan:
name: "{{ item }}"
state: absent
provider: "{{ provider }}"
loop:
- External
- Internal

- name: Issue 01430 - Remove iRules
bigip_irule:
name: "{{ item }}"
module: ltm
state: absent
provider: "{{ provider }}"
loop:
- irule1
- irule2
- irule3
- irule4

- name: Issue 01430 - Remove pool
bigip_pool:
lb_method: round-robin
name: web-pool
state: absent
provider: "{{ provider }}"
@@ -53,6 +53,9 @@
- import_tasks: issue-01403.yaml
tags: issue-01295

- import_tasks: issue-01430.yaml
tags: issue-01430

- import_tasks: issue-01445.yaml
tags: issue-01445

0 comments on commit ddc8f56

Please sign in to comment.
You can’t perform that action at this time.