ansible-collections / community.windows

Windows community collection for Ansible
https://galaxy.ansible.com/community/windows
GNU General Public License v3.0
199 stars 153 forks source link

new module: win_pending_reboot_info #451

Closed ghost closed 1 year ago

ghost commented 1 year ago
SUMMARY

Module for getting information about pending reboots.

The idea is not fresh and exists in different implementations:

This implementation was made possible because I wanted something native to Ansible and the possibility of using it alongside the win_reboot module. This partially covers my case described in ansible.windows/issues/182

How it works: The module checks for well-known pending reboot flags and outputs the result.

The following checks are now supported:

By default all checks are enabled, but some of them can be disabled using the skip list. For example you can disable the check of the CCM Client if it is not used in your environment. skip is only one option for this module.

The output is a dictionary with checks and their results (true/false) and a reboot_required key with the overall result (if at least one of the checks is true, the result is true)

Example:

test-host1 | SUCCESS => {
    "changed": false,
    "checks": {
        "cbs": false,
        "ccm_client": false,
        "computer_rename": false,
        "dsc_lcm": false,
        "dvd_reboot_signal": false,
        "file_rename": true,
        "join_domain": false,
        "server_manager": false,
        "windows_update": false
    },
    "reboot_required": true
}

You can register return value and use it later for when condition for win_reboot for example.

ISSUE TYPE
COMPONENT NAME

win_pending_reboot_info.ps1

ADDITIONAL INFORMATION

https://docs.microsoft.com/en-us/powershell/scripting/dsc/configurations/reboot-a-node?view=powershell-7.1 https://adamtheautomator.com/pending-reboot-registry-windows/

jborean93 commented 1 year ago

Apologies for not getting back to your earlier, I've been away for AnsibleFest and took some time off afterwards and have only just gotten back.

Thanks for the great work you've done here, the quality of the new code and the tests added is fantastic. Unfortunately as per the README https://github.com/ansible-collections/community.windows#contributing-to-this-collection we are currently not accepting new module contributions to this collection.

This is not a reflection of the work you've done but rather resource limitations on our end for maintaining this collection is very limited and we can't handle even more code to maintain at this point in time. I do apologise for the mess around as I need to go through the existing issues that are asking for new modules and close them but I've just not gotten around to it yet.

I highly recommend you pack this up in your own collection and publish it to the gallery. You are more than welcome to update the original issue to point people to this collection as well. The benefits of having this in your own collection is you are in full control over the release cycle and reviews. You no longer have to wait for us to come around and review things and can merge/release at your own pace.

Once again sorry for the mess around, I wish you all the best.