ovirt_hosts: Add option to choose to reboot the host (#35956)

This commit is contained in:
Ondra Machacek 2018-03-08 12:07:03 +01:00 committed by ansibot
parent 19f92005b9
commit d45ceb3a4f

View file

@ -129,6 +129,11 @@ options:
action before executing upgrade action." action before executing upgrade action."
default: True default: True
version_added: 2.4 version_added: 2.4
reboot_after_upgrade:
description:
- "If I(true) and C(state) is I(upgraded) reboot host after successful upgrade."
default: True
version_added: 2.6
extends_documentation_fragment: ovirt extends_documentation_fragment: ovirt
''' '''
@ -412,6 +417,7 @@ def main():
activate=dict(default=True, type='bool'), activate=dict(default=True, type='bool'),
iscsi=dict(default=None, type='dict'), iscsi=dict(default=None, type='dict'),
check_upgrade=dict(default=True, type='bool'), check_upgrade=dict(default=True, type='bool'),
reboot_after_upgrade=dict(default=True, type='bool'),
) )
module = AnsibleModule( module = AnsibleModule(
argument_spec=argument_spec, argument_spec=argument_spec,
@ -497,6 +503,7 @@ def main():
wait_condition=lambda h: h.status == result_state, wait_condition=lambda h: h.status == result_state,
post_action=lambda h: time.sleep(module.params['poll_interval']), post_action=lambda h: time.sleep(module.params['poll_interval']),
fail_condition=hosts_module.failed_state_after_reinstall, fail_condition=hosts_module.failed_state_after_reinstall,
reboot=module.params['reboot_after_upgrade'],
) )
elif state == 'iscsidiscover': elif state == 'iscsidiscover':
host_id = get_id_by_name(hosts_service, module.params['name']) host_id = get_id_by_name(hosts_service, module.params['name'])