Skip to content

Commit

Permalink
Merge branch 'devel'
Browse files Browse the repository at this point in the history
  • Loading branch information
urohit011 committed Oct 24, 2024
2 parents 945f67a + 4da0202 commit 6756b7d
Show file tree
Hide file tree
Showing 26 changed files with 1,171 additions and 101 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ being included in this project.
[repoinstall]: https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#installing-a-collection-from-a-git-repository
[dailybuild]: https://f5-ansible.s3.amazonaws.com/collections/f5networks-f5os-devel.tar.gz
[ansible_issues]: https://github.com/F5Networks/f5-ansible-f5os/issues
[License]: https://github.com/f5devcentral/f5-ansible-bigip/blob/master/COPYING
[License]: https://www.gnu.org/licenses/gpl-3.0.txt
[ansiblehelp]: http://clouddocs.f5.com/products/orchestration/ansible/devel/
[execenv]: https://docs.ansible.com/automation-controller/latest/html/userguide/execution_environments.html
[f5execenv]: http://clouddocs.f5.com/products/orchestration/ansible/devel/usage/exec-env.html
Expand Down
13 changes: 13 additions & 0 deletions ansible_collections/f5networks/f5os/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ F5Networks.F5OS Release Notes

.. contents:: Topics

v1.12.0
=======

Minor Changes
-------------

- f5os_tenant - added a new parameter, virtual_disk_size, to set the virtual disk size of the tenant

Bugfixes
--------

- f5os_lag - fixed a bug that used to occur while adding trunk or native vlans

v1.11.0
=======

Expand Down
2 changes: 1 addition & 1 deletion ansible_collections/f5networks/f5os/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ being included in this project.
[repoinstall]: https://docs.ansible.com/ansible/latest/user_guide/collections_using.html#installing-a-collection-from-a-git-repository
[dailybuild]: https://f5-ansible.s3.amazonaws.com/collections/f5networks-f5os-devel.tar.gz
[ansible_issues]: https://github.com/F5Networks/f5-ansible-f5os/issues
[License]: https://github.com/f5devcentral/f5-ansible-bigip/blob/master/COPYING
[License]: https://www.gnu.org/licenses/gpl-3.0.txt
[ansiblehelp]: http://clouddocs.f5.com/products/orchestration/ansible/devel/
[execenv]: https://docs.ansible.com/automation-controller/latest/html/userguide/execution_environments.html
[f5execenv]: http://clouddocs.f5.com/products/orchestration/ansible/devel/usage/exec-env.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ plugins:
strategy: {}
test: {}
vars: {}
version: 1.11.0
version: 1.12.0
11 changes: 11 additions & 0 deletions ansible_collections/f5networks/f5os/changelogs/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,17 @@ releases:
name: f5os_tls_cert_key
namespace: ''
release_date: '2024-09-10'
1.12.0:
changes:
bugfixes:
- f5os_lag - fixed a bug that used to occur while adding trunk or native vlans
minor_changes:
- f5os_tenant - added a new parameter, virtual_disk_size, to set the virtual
disk size of the tenant
fragments:
- lag_bugfix.yaml
- tenant_virtual_disk_size_param.yaml
release_date: '2024-10-24'
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.11.0
version: 1.12.0
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def nested_diff(want, have, invalid):
if k not in have:
return True
else:
if type(want[k]) is dict:
if isinstance(want[k], dict):
if nested_diff(want[k], have[k], invalid):
return True
else:
Expand Down
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.11.0"
CURRENT_COLL_VERSION = "1.12.0"
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
default: present
author:
- Ravinder Reddy (@chinthalapalli)
notes:
- This Modules will only make patch calls to add the DNS servers and domains.
- It does not support the deletion of difference DNS servers and domains from the existing list while updating,it just adds new entries.
- When state is C(absent) it will B(delete) the DNS servers and domains from the user provided list.
'''

EXAMPLES = r'''
Expand Down
29 changes: 29 additions & 0 deletions ansible_collections/f5networks/f5os/plugins/modules/f5os_lag.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,32 @@
name: "Arista"
trunk_vlans: [444, 555]
state: absent
- name: Create a FAST and PASSIVE lacp LAG interface
f5os_lag:
name: "Arista"
lag_type: "lacp"
mode: "passive"
interval: "fast"
native_vlan: 666
trunk_vlans: [444, 555]
config_members:
- "1.0"
- "2.0"
state: present
- name: Create a SLOW and ACTIVE lacp LAG interface
f5os_lag:
name: "Arista"
lag_type: "lacp"
mode: "active"
interval: "slow"
native_vlan: 666
trunk_vlans: [444, 555]
config_members:
- "1.0"
- "2.0"
state: present
'''

RETURN = r'''
Expand Down Expand Up @@ -500,6 +526,9 @@ def create_on_device(self):
"lag-type": params['lag_type'],
"f5-if-aggregate:distribution-hash": "src-dst-ipport",
},
"openconfig-vlan:switched-vlan": {
"config": {},
},
}
}
payload = {
Expand Down
58 changes: 24 additions & 34 deletions ansible_collections/f5networks/f5os/plugins/modules/f5os_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@
facility:
description: Filter logs on facility local0 or authpriv.
type: str
choices:
- local0
- authpriv
severity:
description: Specify the minimum seceverity to be forwarded to this server
description: Specify the minimum severity to be forwarded to this server
type: str
choices:
- debug
Expand All @@ -80,7 +83,7 @@
description: Filter logs on facility.
type: str
severity:
description: Specify the minimum seceverity to be forwarded to remote servers
description: Specify the minimum severity to be forwarded to remote servers
type: str
choices:
- debug
Expand Down Expand Up @@ -536,9 +539,8 @@ def exists(self, query=None):

if hasattr(self.want, 'servers') and self.want.servers is not None:
for server in self.want.servers:
uri = f'{base_uri}/remote-servers/remote-server="{server["address"]}"'
uri = f'{base_uri}/remote-servers/remote-server={server["address"]}'
response = self.client.get(uri)

if response['code'] == 200:
if query in ['any', 'still']:
return True
Expand Down Expand Up @@ -684,11 +686,7 @@ def create_on_device(self):
}
}
if 'authentication' in server and server['authentication'] is not None:
server_conf['config'] = {
'f5-openconfig-system-logging:authentication': {
'enabled': server['authentication']
}
}
server_conf['config'].update({'f5-openconfig-system-logging:authentication': {'enabled': server['authentication']}})
if 'logs' in server and server['logs'] is not None:
server_conf['selectors'] = {
'selector': list()
Expand All @@ -704,7 +702,6 @@ def create_on_device(self):
}
server_conf['selectors']['selector'].append(log_conf)
server_list.append(server_conf)

response = self.client.post(uri, data=payload)
if response['code'] == 409:
# This object exists already, so override it
Expand All @@ -731,7 +728,6 @@ def create_on_device(self):
def update_on_device(self):
params = self.changes.api_params()
base_uri = '/openconfig-system:system/logging'

if 'tls' in params and params['tls'] is not None:
uri = f'{base_uri}/f5-openconfig-system-logging:tls'
payload = {
Expand All @@ -741,7 +737,6 @@ def update_on_device(self):
response = self.client.put(uri, data=payload)
if response['code'] not in [200, 204]:
raise F5ModuleError(response['contents'])

if 'ca_bundles' in params and params['ca_bundles'] is not None:
for bundle in params['ca_bundles']:
uri = f'{base_uri}/f5-openconfig-system-logging:tls/ca-bundles/ca-bundle="{bundle["name"]}"'
Expand All @@ -759,9 +754,9 @@ def update_on_device(self):
if 'remote_forwarding' in params and params['remote_forwarding'] is not None:
uri = f'{base_uri}/f5-openconfig-system-logging:host-logs/config'
payload = {
'config': dict()
'f5-openconfig-system-logging:config': dict()
}
conf = payload['config']
conf = payload['f5-openconfig-system-logging:config']
conf['remote-forwarding'] = {
'enabled': params['remote_forwarding']['enabled']
}
Expand All @@ -771,7 +766,7 @@ def update_on_device(self):
}
for log in params['remote_forwarding']['logs']:
log_conf = {
'facility': f'openconfig-system-loggin:{log["facility"].upper()}',
'facility': f'openconfig-system-logging:{log["facility"].upper()}',
'severity': log['severity'].upper()
}
conf['selectors']['selector'].append(log_conf)
Expand All @@ -789,16 +784,12 @@ def update_on_device(self):
response = self.client.put(uri, data=payload)
if response['code'] not in [200, 204]:
raise F5ModuleError(response['contents'])

if 'servers' in params and params['servers'] is not None:
uri = f'{base_uri}/remote-servers'
payload = {
'openconfig-system:remote-servers': {
'remote-server': list()
}
}
server_list = payload['openconfig-system:remote-servers']['remote-server']

for server in params['servers']:
payload = {'remote-server': list()}

server_conf = {
'host': server['address'],
'config': {
Expand All @@ -809,16 +800,13 @@ def update_on_device(self):
}

if 'authentication' in server and server['authentication'] is not None:
server_conf['config'] = {
'f5-openconfig-system-logging:authentication': {
'enabled': server['authentication']
}
}
server_conf['config']['f5-openconfig-system-logging:authentication'] = dict()
server_conf['config']['f5-openconfig-system-logging:authentication'] = {'enabled': server['authentication']}

if 'logs' in server and server['logs'] is not None:
server_conf['selectors'] = {
'selector': list()
}
server_conf['selectors'] = dict()
server_conf['selectors'] = {'selector': list()}

for log in server['logs']:
log_conf = {
'facility': f'f5-system-logging-types:{log["facility"].upper()}',
Expand All @@ -829,12 +817,11 @@ def update_on_device(self):
}
}
server_conf['selectors']['selector'].append(log_conf)
server_list.append(server_conf)

response = self.client.put(uri, data=payload)
payload['remote-server'].append(server_conf)
response = self.client.put(f'{uri}/remote-server={server["address"]}', data=payload)
if response['code'] not in [200, 204]:
raise F5ModuleError(response['contents'])

if 'include_hostname' in params and params['include_hostname'] is not None:
uri = f'{base_uri}/f5-openconfig-system-logging:config'
payload = {
Expand Down Expand Up @@ -969,7 +956,10 @@ def __init__(self):
type='list',
elements='dict',
options=dict(
facility=dict(type='str'),
facility=dict(
type='str',
choices=['local0', 'authpriv']
),
severity=dict(
type='str',
choices=ArgumentSpec.severities
Expand Down
22 changes: 14 additions & 8 deletions ansible_collections/f5networks/f5os/plugins/modules/f5os_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ def update_on_device(self):
response = self.client.patch(uri, data=payload)
if response['code'] not in [200, 201, 202, 204]:
raise F5ModuleError(response['contents'])
# time.sleep(65)
return True

def remove_from_device(self):
Expand Down Expand Up @@ -800,31 +801,36 @@ def read_current_from_device(self):
# Motd, login_banner, hostname
uri = "/openconfig-system:system/config"
response = self.client.get(uri)
if response['code'] not in [200, 201, 202]:
if response['code'] not in [200, 201, 202, 204]:
raise F5ModuleError(response['contents']['openconfig-system:config'])
if response['code'] in [200]:
params['config'] = response['contents']['openconfig-system:config']

# Clock
clock_uri = "/openconfig-system:system/clock"
clock_response = self.client.get(clock_uri)
if clock_response['code'] not in [200, 201, 202]:
if clock_response['code'] not in [200, 201, 202, 204]:
raise F5ModuleError(clock_response['contents']['openconfig-system:clock'])
if response['code'] in [200]:
params['clock'] = clock_response['contents']['openconfig-system:clock']

# Ciphers
ciphers_uri = '/openconfig-system:system/f5-security-ciphers:security/services/service'
# /services/service'
ciphers_response = self.client.get(ciphers_uri)
if ciphers_response['code'] not in [200, 201, 202]:
if ciphers_response['code'] not in [200, 201, 202, 204]:
raise F5ModuleError(ciphers_response['contents']['f5-security-ciphers:service'])
if ciphers_response['code'] in [200]:
params['ciphers'] = ciphers_response['contents']['f5-security-ciphers:service']

# Settings
settings_uri = '/openconfig-system:system/f5-system-settings:settings'
settings_response = self.client.get(settings_uri)
if settings_response['code'] not in [200, 201, 202]:
if settings_response['code'] not in [200, 201, 202, 204]:
raise F5ModuleError(settings_response['contents']['f5-system-settings:settings'])
if settings_response['code'] in [200]:
params['settings'] = settings_response['contents']['f5-system-settings:settings']

params['config'] = response['contents']['openconfig-system:config']
params['clock'] = clock_response['contents']['openconfig-system:clock']
params['ciphers'] = ciphers_response['contents']['f5-security-ciphers:service']
params['settings'] = settings_response['contents']['f5-system-settings:settings']
return ApiParameters(params=params)


Expand Down
Loading

0 comments on commit 6756b7d

Please sign in to comment.