|
|
@ -3,13 +3,16 @@
|
|
|
|
# I am a module that indirectly depends on glibc cached /etc/resolv.conf state.
|
|
|
|
# I am a module that indirectly depends on glibc cached /etc/resolv.conf state.
|
|
|
|
|
|
|
|
|
|
|
|
import socket
|
|
|
|
import socket
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
module = AnsibleModule(argument_spec={'name': {'type': 'str'}})
|
|
|
|
module = AnsibleModule(argument_spec={'name': {'type': 'str'}})
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
module.exit_json(addr=socket.gethostbyname(module.params['name']))
|
|
|
|
module.exit_json(addr=socket.gethostbyname(module.params['name']))
|
|
|
|
except socket.error as e:
|
|
|
|
except socket.error:
|
|
|
|
|
|
|
|
e = sys.exc_info()[1]
|
|
|
|
module.fail_json(msg=str(e))
|
|
|
|
module.fail_json(msg=str(e))
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|