diff options
Diffstat (limited to 'plugins/modules/vyos_banner.py')
-rw-r--r-- | plugins/modules/vyos_banner.py | 17 |
1 files changed, 5 insertions, 12 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) |