Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

win_hostname Reboot #126

Closed
jimbo8098 opened this issue Nov 11, 2020 · 1 comment
Closed

win_hostname Reboot #126

jimbo8098 opened this issue Nov 11, 2020 · 1 comment

Comments

@jimbo8098
Copy link

SUMMARY

Currently, when changing hostname on a Windows server you usually have to reboot leading to two separate tasks, just like in the example documentation:

- name: Change the hostname to sample-hostname
  ansible.windows.win_hostname:
    name: sample-hostname
  register: res

- name: Reboot
  ansible.windows.win_reboot:
  when: res.reboot_required

Would it be worthwhile to add a reboot parameter to this which would simply reboot the machine following it's renaming?

- name: Change the hostname to sample-hostname
  ansible.windows.win_hostname:
    name: sample-hostname
    reboot: yes
ISSUE TYPE
  • Feature Idea
COMPONENT NAME

win_hostname

ADDITIONAL INFORMATION
- name: Change the hostname to sample-hostname
  ansible.windows.win_hostname:
    name: sample-hostname
    reboot: yes
@jborean93
Copy link
Collaborator

This would require us to create an action plugin wrapper for win_hostname like we do for win_updates. Unfortunately action plugins add a lot more complication to the mix and is not something I would probably recommend we do. The only reason why we have it for win_updates is for these 2 reasons

  • More updates may be available after a reboot and that's currently impossible to write in a play using until
    • until only works for 1 task and not multiple ones so the win_updates + win_reboot task won't work there
  • When rebooting after updates, the host may not be fully available when WinRM is online
    • The reboot task in win_updates has a special check to handle this problem which is unique to updates

Because win_hostname just needs a simple reboot and it's done there really isn't any need to diverge from the norm here. Because of the complexity it adds with a very minor benefit I'm going to close this feature request. If you wish to discuss it further we are happy to talk about it at the Windows Working Group. Feel free to add it to the agenda or even just have a chat on #ansible-windows in IRC Freenode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants