summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/windows/win_reboot.py
blob: c8f179e7dd409575dea63f67482796afccfc6437 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/python
# -*- coding: utf-8 -*-

# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible.  If not, see <http://www.gnu.org/licenses/>.

# this is a windows documentation stub.  actual code lives in the .ps1
# file of the same name

ANSIBLE_METADATA = {'status': ['stableinterface'],
                    'supported_by': 'core',
                    'version': '1.0'}

DOCUMENTATION='''
---
module: win_reboot
short_description: Reboot a windows machine
description:
     - Reboot a Windows machine, wait for it to go down, come back up, and respond to commands.
version_added: "2.1"
options:
  pre_reboot_delay_sec:
    description:
    - Seconds for shutdown to wait before requesting reboot
    default: 2
  shutdown_timeout_sec:
    description:
    - Maximum seconds to wait for shutdown to occur
    - Increase this timeout for very slow hardware, large update applications, etc
    default: 600
  reboot_timeout_sec:
    description:
    - Maximum seconds to wait for machine to re-appear on the network and respond to a test command
    - This timeout is evaluated separately for both network appearance and test command success (so maximum clock time is actually twice this value)
    default: 600
  connect_timeout_sec:
    description:
    - Maximum seconds to wait for a single successful TCP connection to the WinRM endpoint before trying again
    default: 5
  test_command:
    description:
    - Command to expect success for to determine the machine is ready for management
    default: whoami
author:
    - Matt Davis (@nitzmahone)
'''

EXAMPLES='''
# unconditionally reboot the machine with all defaults
- win_reboot:

# apply updates and reboot if necessary
- win_updates:
  register: update_result
- win_reboot:
  when: update_result.reboot_required

# reboot a slow machine that might have lots of updates to apply
- win_reboot:
    shutdown_timeout_sec: 3600
    reboot_timeout_sec: 3600
'''

RETURNS='''
rebooted:
    description: true if the machine was rebooted
    returned: always
    type: boolean
    sample: true
'''