|
|
@ -240,7 +240,7 @@ class Host(object):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if self._module.check_mode:
|
|
|
|
if self._module.check_mode:
|
|
|
|
self._module.exit_json(changed=True)
|
|
|
|
self._module.exit_json(changed=True)
|
|
|
|
self._zapi.host.delete({'hostid': host_id})
|
|
|
|
self._zapi.host.delete([host_id])
|
|
|
|
except Exception, e:
|
|
|
|
except Exception, e:
|
|
|
|
self._module.fail_json(msg="Failed to delete host %s: %s" % (host_name, e))
|
|
|
|
self._module.fail_json(msg="Failed to delete host %s: %s" % (host_name, e))
|
|
|
|
|
|
|
|
|
|
|
@ -485,6 +485,10 @@ def main():
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
module.exit_json(changed=False)
|
|
|
|
module.exit_json(changed=False)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
if state == "absent":
|
|
|
|
|
|
|
|
# the host is already deleted.
|
|
|
|
|
|
|
|
module.exit_json(changed=False)
|
|
|
|
|
|
|
|
|
|
|
|
# Use proxy specified, or set to 0 when adding new host
|
|
|
|
# Use proxy specified, or set to 0 when adding new host
|
|
|
|
if proxy:
|
|
|
|
if proxy:
|
|
|
|
proxy_id = host.get_proxyid_by_proxy_name(proxy)
|
|
|
|
proxy_id = host.get_proxyid_by_proxy_name(proxy)
|
|
|
@ -505,4 +509,3 @@ def main():
|
|
|
|
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
from ansible.module_utils.basic import *
|
|
|
|
main()
|
|
|
|
main()
|
|
|
|
|
|
|
|
|
|
|
|