You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
436 B
Python
17 lines
436 B
Python
7 years ago
|
#!/usr/bin/python
|
||
|
|
||
|
# I am a module that indirectly depends on glibc cached /etc/resolv.conf state.
|
||
|
|
||
|
import socket
|
||
|
from ansible.module_utils.basic import AnsibleModule
|
||
|
|
||
|
def main():
|
||
|
module = AnsibleModule(argument_spec={'name': {'type': 'str'}})
|
||
|
try:
|
||
|
module.exit_json(addr=socket.gethostbyname(module.params['name']))
|
||
|
except socket.error, e:
|
||
|
module.fail_json(msg=str(e))
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|