summaryrefslogtreecommitdiff
path: root/plugins/modules
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/modules')
-rw-r--r--plugins/modules/vyos_banner.py17
-rw-r--r--plugins/modules/vyos_bgp_address_family.py1
-rw-r--r--plugins/modules/vyos_bgp_global.py1
-rw-r--r--plugins/modules/vyos_command.py11
-rw-r--r--plugins/modules/vyos_config.py19
-rw-r--r--plugins/modules/vyos_facts.py11
-rw-r--r--plugins/modules/vyos_firewall_global.py1
-rw-r--r--plugins/modules/vyos_firewall_interfaces.py1
-rw-r--r--plugins/modules/vyos_firewall_rules.py1
-rw-r--r--plugins/modules/vyos_hostname.py1
-rw-r--r--plugins/modules/vyos_interfaces.py1
-rw-r--r--plugins/modules/vyos_l3_interfaces.py1
-rw-r--r--plugins/modules/vyos_lag_interfaces.py1
-rw-r--r--plugins/modules/vyos_lldp_global.py1
-rw-r--r--plugins/modules/vyos_lldp_interfaces.py1
-rw-r--r--plugins/modules/vyos_logging.py18
-rw-r--r--plugins/modules/vyos_logging_global.py1
-rw-r--r--plugins/modules/vyos_ntp_global.py1
-rw-r--r--plugins/modules/vyos_ospf_interfaces.py1
-rw-r--r--plugins/modules/vyos_ospfv2.py1
-rw-r--r--plugins/modules/vyos_ospfv3.py1
-rw-r--r--plugins/modules/vyos_ping.py16
-rw-r--r--plugins/modules/vyos_prefix_lists.py1
-rw-r--r--plugins/modules/vyos_route_maps.py1
-rw-r--r--plugins/modules/vyos_snmp_server.py1
-rw-r--r--plugins/modules/vyos_static_routes.py1
-rw-r--r--plugins/modules/vyos_system.py17
-rw-r--r--plugins/modules/vyos_user.py15
-rw-r--r--plugins/modules/vyos_vlan.py36
29 files changed, 69 insertions, 111 deletions
diff --git a/plugins/modules/vyos_banner.py b/plugins/modules/vyos_banner.py
index a5f3fb9..0ee10f5 100644
--- a/plugins/modules/vyos_banner.py
+++ b/plugins/modules/vyos_banner.py
@@ -91,6 +91,7 @@ commands:
import re
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
get_config,
load_config,
@@ -104,21 +105,13 @@ def spec_to_commands(updates, module):
if state == "absent":
if have.get("state") != "absent" or (
- have.get("state") != "absent"
- and "text" in have.keys()
- and have["text"]
+ have.get("state") != "absent" and "text" in have.keys() and have["text"]
):
- commands.append(
- "delete system login banner %s" % module.params["banner"]
- )
+ commands.append("delete system login banner %s" % module.params["banner"])
elif state == "present":
- if want["text"] and want["text"].encode().decode(
- "unicode_escape"
- ) != have.get("text"):
- banner_cmd = (
- "set system login banner %s " % module.params["banner"]
- )
+ if want["text"] and want["text"].encode().decode("unicode_escape") != have.get("text"):
+ banner_cmd = "set system login banner %s " % module.params["banner"]
banner_cmd += want["text"].strip()
commands.append(banner_cmd)
diff --git a/plugins/modules/vyos_bgp_address_family.py b/plugins/modules/vyos_bgp_address_family.py
index ab98e3b..ba56309 100644
--- a/plugins/modules/vyos_bgp_address_family.py
+++ b/plugins/modules/vyos_bgp_address_family.py
@@ -1163,6 +1163,7 @@ EXAMPLES = """
"""
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.bgp_address_family.bgp_address_family import (
Bgp_address_familyArgs,
)
diff --git a/plugins/modules/vyos_bgp_global.py b/plugins/modules/vyos_bgp_global.py
index 49e0a72..1e3578d 100644
--- a/plugins/modules/vyos_bgp_global.py
+++ b/plugins/modules/vyos_bgp_global.py
@@ -1411,6 +1411,7 @@ EXAMPLES = """
"""
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.bgp_global.bgp_global import (
Bgp_globalArgs,
)
diff --git a/plugins/modules/vyos_command.py b/plugins/modules/vyos_command.py
index d5ab918..94f16f3 100644
--- a/plugins/modules/vyos_command.py
+++ b/plugins/modules/vyos_command.py
@@ -148,13 +148,12 @@ from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.p
Conditional,
)
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import (
- transform_commands,
to_lines,
-)
-from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
- run_commands,
+ transform_commands,
)
+from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import run_commands
+
def parse_commands(module, warnings):
commands = transform_commands(module)
@@ -216,9 +215,7 @@ def main():
msg = "One or more conditional statements have not been satisfied"
module.fail_json(msg=msg, failed_conditions=failed_conditions)
- result.update(
- {"stdout": responses, "stdout_lines": list(to_lines(responses))}
- )
+ result.update({"stdout": responses, "stdout_lines": list(to_lines(responses))})
module.exit_json(**result)
diff --git a/plugins/modules/vyos_config.py b/plugins/modules/vyos_config.py
index 4b2b31d..2a03d0c 100644
--- a/plugins/modules/vyos_config.py
+++ b/plugins/modules/vyos_config.py
@@ -197,21 +197,17 @@ import re
from ansible.module_utils._text import to_text
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.connection import ConnectionError
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
- load_config,
get_config,
- run_commands,
-)
-from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
get_connection,
+ load_config,
+ run_commands,
)
-
DEFAULT_COMMENT = "configured by vyos_config"
-CONFIG_FILTERS = [
- re.compile(r"set system login user \S+ authentication encrypted-password")
-]
+CONFIG_FILTERS = [re.compile(r"set system login user \S+ authentication encrypted-password")]
def get_candidate(module):
@@ -316,8 +312,7 @@ def run(module, result):
if result.get("filtered"):
result["warnings"].append(
- "Some configuration commands were "
- "removed, please see the filtered key"
+ "Some configuration commands were removed, please see the filtered key"
)
result["changed"] = True
@@ -365,9 +360,7 @@ def main():
result["changed"] = True
run_commands(module, commands=["exit"])
- if result.get("changed") and any(
- (module.params["src"], module.params["lines"])
- ):
+ if result.get("changed") and any((module.params["src"], module.params["lines"])):
msg = (
"To ensure idempotency and correct diff the input configuration lines should be"
" similar to how they appear if present in"
diff --git a/plugins/modules/vyos_facts.py b/plugins/modules/vyos_facts.py
index 5e57821..ae7543c 100644
--- a/plugins/modules/vyos_facts.py
+++ b/plugins/modules/vyos_facts.py
@@ -139,12 +139,13 @@ ansible_net_gather_network_resources:
"""
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.facts.facts import (
FactsArgs,
)
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.facts.facts import (
- Facts,
FACT_RESOURCE_SUBSETS,
+ Facts,
)
@@ -156,17 +157,13 @@ def main():
"""
argument_spec = FactsArgs.argument_spec
- module = AnsibleModule(
- argument_spec=argument_spec, supports_check_mode=True
- )
+ module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
warnings = []
ansible_facts = {}
if module.params.get("available_network_resources"):
- ansible_facts["available_network_resources"] = sorted(
- FACT_RESOURCE_SUBSETS.keys()
- )
+ ansible_facts["available_network_resources"] = sorted(FACT_RESOURCE_SUBSETS.keys())
result = Facts(module).get_facts()
additional_facts, additional_warnings = result
ansible_facts.update(additional_facts)
diff --git a/plugins/modules/vyos_firewall_global.py b/plugins/modules/vyos_firewall_global.py
index 02f4f60..78db9f3 100644
--- a/plugins/modules/vyos_firewall_global.py
+++ b/plugins/modules/vyos_firewall_global.py
@@ -1185,6 +1185,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.firewall_global.firewall_global import (
Firewall_globalArgs,
)
diff --git a/plugins/modules/vyos_firewall_interfaces.py b/plugins/modules/vyos_firewall_interfaces.py
index 7ca936d..32ad09f 100644
--- a/plugins/modules/vyos_firewall_interfaces.py
+++ b/plugins/modules/vyos_firewall_interfaces.py
@@ -1251,6 +1251,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.firewall_interfaces.firewall_interfaces import (
Firewall_interfacesArgs,
)
diff --git a/plugins/modules/vyos_firewall_rules.py b/plugins/modules/vyos_firewall_rules.py
index 9730c4a..c219f54 100644
--- a/plugins/modules/vyos_firewall_rules.py
+++ b/plugins/modules/vyos_firewall_rules.py
@@ -1486,6 +1486,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.firewall_rules.firewall_rules import (
Firewall_rulesArgs,
)
diff --git a/plugins/modules/vyos_hostname.py b/plugins/modules/vyos_hostname.py
index da22f41..46b692a 100644
--- a/plugins/modules/vyos_hostname.py
+++ b/plugins/modules/vyos_hostname.py
@@ -249,6 +249,7 @@ parsed:
"""
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.hostname.hostname import (
HostnameArgs,
)
diff --git a/plugins/modules/vyos_interfaces.py b/plugins/modules/vyos_interfaces.py
index 4429e4b..47ff604 100644
--- a/plugins/modules/vyos_interfaces.py
+++ b/plugins/modules/vyos_interfaces.py
@@ -1097,6 +1097,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.interfaces.interfaces import (
InterfacesArgs,
)
diff --git a/plugins/modules/vyos_l3_interfaces.py b/plugins/modules/vyos_l3_interfaces.py
index 7ec9e2a..cdf5842 100644
--- a/plugins/modules/vyos_l3_interfaces.py
+++ b/plugins/modules/vyos_l3_interfaces.py
@@ -537,6 +537,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.l3_interfaces.l3_interfaces import (
L3_interfacesArgs,
)
diff --git a/plugins/modules/vyos_lag_interfaces.py b/plugins/modules/vyos_lag_interfaces.py
index a530789..fb36592 100644
--- a/plugins/modules/vyos_lag_interfaces.py
+++ b/plugins/modules/vyos_lag_interfaces.py
@@ -743,6 +743,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.lag_interfaces.lag_interfaces import (
Lag_interfacesArgs,
)
diff --git a/plugins/modules/vyos_lldp_global.py b/plugins/modules/vyos_lldp_global.py
index 192aa7f..f59327a 100644
--- a/plugins/modules/vyos_lldp_global.py
+++ b/plugins/modules/vyos_lldp_global.py
@@ -467,6 +467,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.lldp_global.lldp_global import (
Lldp_globalArgs,
)
diff --git a/plugins/modules/vyos_lldp_interfaces.py b/plugins/modules/vyos_lldp_interfaces.py
index 43ff75c..9260cb6 100644
--- a/plugins/modules/vyos_lldp_interfaces.py
+++ b/plugins/modules/vyos_lldp_interfaces.py
@@ -635,6 +635,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.lldp_interfaces.lldp_interfaces import (
Lldp_interfacesArgs,
)
diff --git a/plugins/modules/vyos_logging.py b/plugins/modules/vyos_logging.py
index 4b3eaaf..7e1dea7 100644
--- a/plugins/modules/vyos_logging.py
+++ b/plugins/modules/vyos_logging.py
@@ -153,7 +153,6 @@ commands:
"""
import re
-
from copy import deepcopy
from ansible.module_utils._text import to_text
@@ -162,6 +161,7 @@ from ansible.module_utils.common.validation import check_required_if
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import (
remove_default_spec,
)
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
get_config,
load_config,
@@ -189,9 +189,7 @@ def spec_to_commands(updates, module):
)
else:
commands.append(
- "delete system syslog {0} facility {1} level {2}".format(
- dest, facility, level
- )
+ "delete system syslog {0} facility {1} level {2}".format(dest, facility, level)
)
elif state == "present" and w not in have:
if w["name"]:
@@ -202,9 +200,7 @@ def spec_to_commands(updates, module):
)
else:
commands.append(
- "set system syslog {0} facility {1} level {2}".format(
- dest, facility, level
- )
+ "set system syslog {0} facility {1} level {2}".format(dest, facility, level)
)
return commands
@@ -285,9 +281,7 @@ def map_params_to_obj(module, required_if=None):
def main():
"""main entry point for module execution"""
element_spec = dict(
- dest=dict(
- type="str", choices=["console", "file", "global", "host", "user"]
- ),
+ dest=dict(type="str", choices=["console", "file", "global", "host", "user"]),
name=dict(type="str"),
facility=dict(type="str"),
level=dict(type="str"),
@@ -299,9 +293,7 @@ def main():
# remove default in aggregate spec, to handle common arguments
remove_default_spec(aggregate_spec)
- argument_spec = dict(
- aggregate=dict(type="list", elements="dict", options=aggregate_spec)
- )
+ argument_spec = dict(aggregate=dict(type="list", elements="dict", options=aggregate_spec))
argument_spec.update(element_spec)
diff --git a/plugins/modules/vyos_logging_global.py b/plugins/modules/vyos_logging_global.py
index 6a4e2dd..18248d6 100644
--- a/plugins/modules/vyos_logging_global.py
+++ b/plugins/modules/vyos_logging_global.py
@@ -741,6 +741,7 @@ parsed:
"""
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.logging_global.logging_global import (
Logging_globalArgs,
)
diff --git a/plugins/modules/vyos_ntp_global.py b/plugins/modules/vyos_ntp_global.py
index d06d878..10a2170 100644
--- a/plugins/modules/vyos_ntp_global.py
+++ b/plugins/modules/vyos_ntp_global.py
@@ -780,6 +780,7 @@ parsed:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.ntp_global.ntp_global import (
Ntp_globalArgs,
)
diff --git a/plugins/modules/vyos_ospf_interfaces.py b/plugins/modules/vyos_ospf_interfaces.py
index 61ef32e..9a78ebd 100644
--- a/plugins/modules/vyos_ospf_interfaces.py
+++ b/plugins/modules/vyos_ospf_interfaces.py
@@ -888,6 +888,7 @@ EXAMPLES = """
"""
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.ospf_interfaces.ospf_interfaces import (
Ospf_interfacesArgs,
)
diff --git a/plugins/modules/vyos_ospfv2.py b/plugins/modules/vyos_ospfv2.py
index 43b0675..863bc6f 100644
--- a/plugins/modules/vyos_ospfv2.py
+++ b/plugins/modules/vyos_ospfv2.py
@@ -1782,6 +1782,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.ospfv2.ospfv2 import (
Ospfv2Args,
)
diff --git a/plugins/modules/vyos_ospfv3.py b/plugins/modules/vyos_ospfv3.py
index 8942cef..4ff6106 100644
--- a/plugins/modules/vyos_ospfv3.py
+++ b/plugins/modules/vyos_ospfv3.py
@@ -631,6 +631,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.ospfv3.ospfv3 import (
Ospfv3Args,
)
diff --git a/plugins/modules/vyos_ping.py b/plugins/modules/vyos_ping.py
index 7934583..8c0330d 100644
--- a/plugins/modules/vyos_ping.py
+++ b/plugins/modules/vyos_ping.py
@@ -134,12 +134,12 @@ rtt:
sample: {"avg": 2, "max": 8, "min": 1, "mdev": 24}
"""
-from ansible.module_utils.basic import AnsibleModule
-from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
- run_commands,
-)
import re
+from ansible.module_utils.basic import AnsibleModule
+
+from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import run_commands
+
def main():
"""main entry point for module execution"""
@@ -150,9 +150,7 @@ def main():
ttl=dict(type="int"),
size=dict(type="int"),
interval=dict(type="int"),
- state=dict(
- type="str", choices=["absent", "present"], default="present"
- ),
+ state=dict(type="str", choices=["absent", "present"], default="present"),
)
module = AnsibleModule(argument_spec=argument_spec)
@@ -170,9 +168,7 @@ def main():
if warnings:
results["warnings"] = warnings
- results["commands"] = [
- build_ping(dest, count, size, interval, source, ttl)
- ]
+ results["commands"] = [build_ping(dest, count, size, interval, source, ttl)]
ping_results = run_commands(module, commands=results["commands"])
ping_results_list = ping_results[0].split("\n")
diff --git a/plugins/modules/vyos_prefix_lists.py b/plugins/modules/vyos_prefix_lists.py
index 8b67caf..ed190d4 100644
--- a/plugins/modules/vyos_prefix_lists.py
+++ b/plugins/modules/vyos_prefix_lists.py
@@ -1294,6 +1294,7 @@ parsed:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.prefix_lists.prefix_lists import (
Prefix_listsArgs,
)
diff --git a/plugins/modules/vyos_route_maps.py b/plugins/modules/vyos_route_maps.py
index 27fac07..d49261c 100644
--- a/plugins/modules/vyos_route_maps.py
+++ b/plugins/modules/vyos_route_maps.py
@@ -918,6 +918,7 @@ EXAMPLES = """
"""
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.route_maps.route_maps import (
Route_mapsArgs,
)
diff --git a/plugins/modules/vyos_snmp_server.py b/plugins/modules/vyos_snmp_server.py
index 1651226..74bae3f 100644
--- a/plugins/modules/vyos_snmp_server.py
+++ b/plugins/modules/vyos_snmp_server.py
@@ -1093,6 +1093,7 @@ parsed:
"""
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.snmp_server.snmp_server import (
Snmp_serverArgs,
)
diff --git a/plugins/modules/vyos_static_routes.py b/plugins/modules/vyos_static_routes.py
index 09105ef..0761599 100644
--- a/plugins/modules/vyos_static_routes.py
+++ b/plugins/modules/vyos_static_routes.py
@@ -900,6 +900,7 @@ commands:
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.argspec.static_routes.static_routes import (
Static_routesArgs,
)
diff --git a/plugins/modules/vyos_system.py b/plugins/modules/vyos_system.py
index fd98507..66a3fd4 100644
--- a/plugins/modules/vyos_system.py
+++ b/plugins/modules/vyos_system.py
@@ -95,6 +95,7 @@ EXAMPLES = """
"""
from ansible.module_utils.basic import AnsibleModule
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
get_config,
load_config,
@@ -155,13 +156,9 @@ def spec_to_commands(want, have):
commands.append("delete system %s" % device_key)
for config in proposed:
if state == "absent" and config in current:
- commands.append(
- "delete system %s '%s'" % (device_key, config)
- )
+ commands.append("delete system %s '%s'" % (device_key, config))
elif state == "present" and config not in current:
- commands.append(
- "set system %s '%s'" % (device_key, config)
- )
+ commands.append("set system %s '%s'" % (device_key, config))
else:
if state == "absent" and current and proposed:
commands.append("delete system %s" % device_key)
@@ -186,12 +183,8 @@ def main():
host_name=dict(type="str"),
domain_name=dict(type="str"),
domain_search=dict(type="list", elements="str"),
- name_server=dict(
- type="list", aliases=["name_servers"], elements="str"
- ),
- state=dict(
- type="str", default="present", choices=["present", "absent"]
- ),
+ name_server=dict(type="list", aliases=["name_servers"], elements="str"),
+ state=dict(type="str", default="present", choices=["present", "absent"]),
)
module = AnsibleModule(
diff --git a/plugins/modules/vyos_user.py b/plugins/modules/vyos_user.py
index b2e1acc..5494df3 100644
--- a/plugins/modules/vyos_user.py
+++ b/plugins/modules/vyos_user.py
@@ -181,26 +181,24 @@ commands:
"""
import re
-
from copy import deepcopy
from functools import partial
from ansible.module_utils.basic import AnsibleModule
+from ansible.module_utils.six import iteritems
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import (
remove_default_spec,
)
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
get_config,
load_config,
)
-from ansible.module_utils.six import iteritems
def validate_level(value, module):
if value not in ("admin", "operator"):
- module.fail_json(
- msg="level must be either admin or operator, got %s" % value
- )
+ module.fail_json(msg="level must be either admin or operator, got %s" % value)
def spec_to_commands(updates, module):
@@ -231,8 +229,7 @@ def spec_to_commands(updates, module):
add(
commands,
want,
- "authentication plaintext-password %s"
- % want["configured_password"],
+ "authentication plaintext-password %s" % want["configured_password"],
)
return commands
@@ -338,9 +335,7 @@ def main():
full_name=dict(),
level=dict(aliases=["role"]),
configured_password=dict(no_log=True),
- update_password=dict(
- default="always", choices=["on_create", "always"]
- ),
+ update_password=dict(default="always", choices=["on_create", "always"]),
state=dict(default="present", choices=["present", "absent"]),
)
diff --git a/plugins/modules/vyos_vlan.py b/plugins/modules/vyos_vlan.py
index 8325366..de20d87 100644
--- a/plugins/modules/vyos_vlan.py
+++ b/plugins/modules/vyos_vlan.py
@@ -164,7 +164,6 @@ commands:
"""
import re
import time
-
from copy import deepcopy
from ansible.module_utils._text import to_text
@@ -173,6 +172,7 @@ from ansible.module_utils.common.validation import check_required_one_of
from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import (
remove_default_spec,
)
+
from ansible_collections.vyos.vyos.plugins.module_utils.network.vyos.vyos import (
load_config,
run_commands,
@@ -204,27 +204,17 @@ def map_obj_to_commands(updates, module):
if obj_in_have:
for obj in obj_in_have:
for i in obj["interfaces"]:
- commands.append(
- "delete interfaces ethernet {0} vif {1}".format(
- i, vlan_id
- )
- )
+ commands.append("delete interfaces ethernet {0} vif {1}".format(i, vlan_id))
elif state == "present":
if not obj_in_have:
if w["interfaces"] and w["vlan_id"]:
for i in w["interfaces"]:
- cmd = "set interfaces ethernet {0} vif {1}".format(
- i, vlan_id
- )
+ cmd = "set interfaces ethernet {0} vif {1}".format(i, vlan_id)
if w["name"]:
- commands.append(
- cmd + " description {0}".format(name)
- )
+ commands.append(cmd + " description {0}".format(name))
elif w["address"]:
- commands.append(
- cmd + " address {0}".format(address)
- )
+ commands.append(cmd + " address {0}".format(address))
else:
commands.append(cmd)
@@ -234,9 +224,7 @@ def map_obj_to_commands(updates, module):
if not obj_in_want:
for i in h["interfaces"]:
commands.append(
- "delete interfaces ethernet {0} vif {1}".format(
- i, h["vlan_id"]
- )
+ "delete interfaces ethernet {0} vif {1}".format(i, h["vlan_id"])
)
return commands
@@ -271,9 +259,7 @@ def map_params_to_obj(module):
"address": module.params["address"],
"state": module.params["state"],
"interfaces": module.params["interfaces"],
- "associated_interfaces": module.params[
- "associated_interfaces"
- ],
+ "associated_interfaces": module.params["associated_interfaces"],
}
)
@@ -338,13 +324,9 @@ def check_declarative_intent_params(want, module, result):
if w.get("associated_interfaces") is None:
continue
for i in w["associated_interfaces"]:
- if (set(obj_interface) - set(w["associated_interfaces"])) != set(
- []
- ):
+ if (set(obj_interface) - set(w["associated_interfaces"])) != set([]):
module.fail_json(
- msg="Interface {0} not configured on vlan {1}".format(
- i, w["vlan_id"]
- )
+ msg="Interface {0} not configured on vlan {1}".format(i, w["vlan_id"])
)