From d881f311dbfe78e9fa06c71440f2cc6752a312a0 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Wed, 4 Sep 2024 07:56:27 +0200 Subject: [PATCH] Not used here --- .../roles/script_server/lookup_plugins/ip.py | 25 ------------------- 1 file changed, 25 deletions(-) delete mode 100644 provision-contest/ansible/roles/script_server/lookup_plugins/ip.py diff --git a/provision-contest/ansible/roles/script_server/lookup_plugins/ip.py b/provision-contest/ansible/roles/script_server/lookup_plugins/ip.py deleted file mode 100644 index e96422a1..00000000 --- a/provision-contest/ansible/roles/script_server/lookup_plugins/ip.py +++ /dev/null @@ -1,25 +0,0 @@ -import ansible.utils as utils -import ansible.errors as errors -from ansible.plugins.lookup import LookupBase -import socket -import ipaddress - -class LookupModule(LookupBase): - - def __init__(self, basedir=None, **kwargs): - self.basedir = basedir - - def run(self, terms, variables=None, **kwargs): - hostname = terms[0] - - try: - # If it's a valid ip address already, just return it directly - ipaddress.ip_address(hostname) - return [hostname] - except Exception: - pass - - if not isinstance(hostname, str): - raise errors.AnsibleError("ip lookup expects a string (hostname)") - - return [socket.gethostbyname(hostname)]