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)]