Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
urohit011 committed Sep 10, 2024
2 parents e8f53f5 + 08cf502 commit 945f67a
Show file tree
Hide file tree
Showing 20 changed files with 5,845 additions and 55 deletions.
11 changes: 11 additions & 0 deletions ansible_collections/f5networks/f5os/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ F5Networks.F5OS Release Notes

.. contents:: Topics

v1.11.0
=======

New Modules
-----------

- f5networks.f5os.f5os_primarykey - Manage F5OS Devices Primary-key Setting.
- f5networks.f5os.f5os_system_image_import - Manage F5OS System image import.
- f5networks.f5os.f5os_system_image_install - Manage F5OS system software installation.
- f5networks.f5os.f5os_tls_cert_key - Manage TLS certificate and key on F5OS devices.

v1.10.1
=======

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ plugins:
name: f5os_allowed_ips
namespace: ''
version_added: 1.9.0
f5os_auth:
description: Manage authentication settings
name: f5os_auth
namespace: ''
version_added: 1.10.0
f5os_config_backup:
description: Manage F5OS config backups.
name: f5os_config_backup
Expand Down Expand Up @@ -55,11 +60,21 @@ plugins:
name: f5os_lldp_config
namespace: ''
version_added: 1.8.0
f5os_logging:
description: Manage logging settings
name: f5os_logging
namespace: ''
version_added: 1.10.0
f5os_ntp_server:
description: Manage NTP servers on F5OS based systems
name: f5os_ntp_server
namespace: ''
version_added: 1.8.0
f5os_primarykey:
description: Manage F5OS Devices Primary-key Setting.
name: f5os_primarykey
namespace: ''
version_added: 1.11.0
f5os_qkview:
description: Manage Generation of qkview file
name: f5os_qkview
Expand All @@ -81,6 +96,16 @@ plugins:
name: f5os_system
namespace: ''
version_added: 1.10.0
f5os_system_image_import:
description: Manage F5OS System image import.
name: f5os_system_image_import
namespace: ''
version_added: 1.11.0
f5os_system_image_install:
description: Manage F5OS system software installation.
name: f5os_system_image_install
namespace: ''
version_added: 1.11.0
f5os_tenant:
description: Manage F5OS tenants
name: f5os_tenant
Expand All @@ -96,6 +121,11 @@ plugins:
name: f5os_tenant_wait
namespace: ''
version_added: 1.0.0
f5os_tls_cert_key:
description: Manage TLS certificate and key on F5OS devices.
name: f5os_tls_cert_key
namespace: ''
version_added: 1.11.0
f5os_user:
description: Manage Users and roles on F5OS based systems
name: f5os_user
Expand Down Expand Up @@ -133,4 +163,4 @@ plugins:
strategy: {}
test: {}
vars: {}
version: 1.10.1
version: 1.11.0
15 changes: 15 additions & 0 deletions ansible_collections/f5networks/f5os/changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,21 @@ releases:
release_date: '2024-08-01'
1.10.1:
release_date: '2024-08-01'
1.11.0:
modules:
- description: Manage F5OS Devices Primary-key Setting.
name: f5os_primarykey
namespace: ''
- description: Manage F5OS System image import.
name: f5os_system_image_import
namespace: ''
- description: Manage F5OS system software installation.
name: f5os_system_image_install
namespace: ''
- description: Manage TLS certificate and key on F5OS devices.
name: f5os_tls_cert_key
namespace: ''
release_date: '2024-09-10'
1.2.0:
modules:
- description: Manage F5OS config backups.
Expand Down
2 changes: 1 addition & 1 deletion ansible_collections/f5networks/f5os/galaxy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ tags:
- networking
- rseries
- velos
version: 1.10.1
version: 1.11.0
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

# This collection version needs to be updated at each release
CURRENT_COLL_VERSION = "1.10.1"
CURRENT_COLL_VERSION = "1.11.0"
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,10 @@ def allowed(self):
}
for protocol_version in ['ipv6', 'ipv4']:
if val[protocol_version] is not None:
result['config'][protocol_version] = dict()
result['config'][protocol_version]['address'] = val[protocol_version]['address']
result['config'][protocol_version]['prefix-length'] = val[protocol_version]['prefix']
result['config'][protocol_version] = {
'address': val[protocol_version]['address'],
'prefix-length': val[protocol_version]['prefix']
}
if 'port' in val[protocol_version] and val[protocol_version]['port'] is not None:
result['config'][protocol_version]['port'] = val[protocol_version]['port']
break
Expand Down Expand Up @@ -299,14 +300,14 @@ def exec_module(self):

def present(self):
'''Wrapper for creation/update'''
if self.exists():
if self.all_exist():
return self.update()
else:
return self.create()

def absent(self):
'''Wrapper for removal'''
if self.exists():
if self.any_exists():
return self.remove()
return False

Expand All @@ -331,7 +332,7 @@ def remove(self) -> bool:
if self.module.check_mode: # pragma: no cover
return True
self.remove_from_device()
if self.exists():
if self.still_exists():
raise F5ModuleError("Failed to delete the resource.")
return True

Expand All @@ -343,19 +344,34 @@ def create(self) -> bool:
self.create_on_device()
return True

def exists(self) -> bool:
def any_exists(self):
return self.exists(query='any')

def all_exist(self):
return self.exists(query='all')

def still_exists(self):
return self.exists(query='still')

def exists(self, query=None) -> bool:
'''Check object existance on F5OS system'''
base_uri = "/openconfig-system:system/f5-allowed-ips:allowed-ips"
if (hasattr(self.want, 'allowed') and getattr(self.want, 'allowed') is not None):
for val in getattr(self.want, 'allowed'):
object_uri = "/allowed-ip={}".format(val['name'])
object_uri = f'/allowed-ip={val["name"]}'

uri = base_uri + object_uri
response = self.client.get(uri)
if response['code'] == 200:
if query in ['any', 'still']:
return True
if response['code'] == 404:
return False
if response['code'] not in [200, 201, 202]:
if query == 'all':
return False
if response['code'] not in [200, 201, 202, 404]:
raise F5ModuleError(response['contents'])
if query in ['any', 'still']:
return False
return True

def create_on_device(self):
Expand All @@ -367,8 +383,11 @@ def create_on_device(self):
for allow_entry in params['allowed']:
payload = {'allowed-ip': [{'name': allow_entry['name'], 'config': allow_entry['config']}]}
response = self.client.post(uri, data=payload)
if response['code'] == 409:
# at least one address in the declaration was missing, but not this one.
response = self.client.put(uri + f'/allowed-ip={allow_entry["name"]}', data=payload)
if response['code'] not in [200, 201, 202, 204]:
raise F5ModuleError(response['contents'])
raise F5ModuleError(str(response['contents']))

return True

Expand All @@ -379,7 +398,7 @@ def update_on_device(self):

if 'allowed' in params:
for allow_entry in params['allowed']:
object_uri = "/allowed-ip={}/config".format(allow_entry['name'])
object_uri = f'/allowed-ip={allow_entry["name"]}/config'
uri = base_uri + object_uri
payload = {'config': allow_entry['config']}
response = self.client.put(uri, data=payload)
Expand All @@ -394,8 +413,8 @@ def remove_from_device(self):
for val in self.want.allowed:
uri = f"/openconfig-system:system/f5-allowed-ips:allowed-ips/allowed-ip={val['name']}"
response = self.client.delete(uri)
if response['code'] not in [200, 201, 202, 204]:
raise F5ModuleError(response['contents'])
if response['code'] not in [200, 201, 202, 204, 404]:
raise F5ModuleError(str(response['contents']))
return True

def read_current_from_device(self):
Expand Down
Loading

0 comments on commit 945f67a

Please sign in to comment.