-
Notifications
You must be signed in to change notification settings - Fork 23.8k
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
New Windows module to chanage CDROM drive letter and unmount virt. cdroms #59872
Conversation
The test
The test
The test
The test
The test
The test
The test
The test
|
Changes made based on sanity report
What's wrong with the Author field? :/
"Got ['RusoSova']" - looks like the script got it right. |
@Daniel-Sanchez-Fabregas @LiranNis @SamLiu79 @ShachafGoldstein @timothyvandenbrande @andrewsaraceni @ar7z1 @blakfeld @brianlloyd @cchurch @chopraaa @chrishoffman @crossan007 @daBONDi @defionscode @dlazz @elventear @equelin @henrikwallstrom @it-praktyk @itigoag @jiuka @johnboy2 @joshludwig @ksubileau @marqelme @mcassaniti @mhunsber @michaeldeaton @nwchandler @nwsparks @petemounce @ptemplier @rcanderson23 @richardcs @riponbanik @sbaerlocher @schwartzmx @smadam813 @themiwi @tksarah @tmmruk As a maintainer of a module in the same namespace this new module has been submitted to, your vote counts for shipits. Please review this module and add |
Thanks to agaffney @ IRC for pointing out that author should be |
I like the idea of having a module to manage which letter a cd/dvd drive is mounted as. (I too, have some win_shell powershell to manage this problem and its ugly!) I do have some reservations about this implementation though. You've tackled some edge cases such as multiple cd/dvd drives and virtual drives, which is great, but I wonder if multiple drives could simply be handled by passing a list of cd/dvd drives to ensure are mounted and perhaps use 'state' module parameter to handle whether a drive is mounted or dismounted, and perhaps whether virtual drives should be dismounted. I'm not sure what the interface would be exactly, but I think it might be possible to make the module parameters a description of how you want the drives arranged once the module has completed. This example bothers me a bit:
It seems the idea here is to just get the cd/dvd drive out of the way as the end state could be that it is mapped to Z, Y or K. Personally this is not how I want to arrange things. I would much rather know that by the time the module has run the Z drive is allways the cd/dvd drive on all machines that it has run against (or the task fails because that couldn't be achieved). I appreciate you may well be trying to bring order to lots of machines which users have mapped drives on to suit their own needs. In which case I'd hope that you could use 'win_disk_facts' (or something similar if that doesn't return information about cd/dvd drives) so you can detect any machine where other drives are already mapped to the destination drive letter you want to use. Also if the drive_letter parameter needs to have more than one letter I think it should take a list, in which case a proper yaml list of letters would be preferable in the examples rather than a comma separated list. I hope the above is of some use - I'd definitely think about having a state: present / absent module parameter. Happy to chat more if you want clarification, but I hope the above is helpful. |
Thank you very much for the feedback. This module started as a simple remap of a single CDROM drive, usually there is a single CDROM drive on a system, but no always. And virtual CDROMs can make this issues even less straight forward. Unfortunately, win_disk_facts does not return information about CDROMs, at least from my testing. I also find win_disk_facts fairly cumbersome to use to pass the information to the subsequent tasks, way to much logic to build in the .yml file. Albeit, I might not be using it “correctly”. The idea was to create simple interface to tackle as many corner cases as possible. There is no way to find the number of CDROMs and their letters via Ansible modules atm.
But if the goal is to make sure no CDROM is taking the “prime” drive letters like D:, E:, F: or any other of your reserved letters, the multi-letter approach will be best.
The above task also guarantees that, if possible, the CDROM will be mapped to Z before it will try to mount it to Y.
Should the CDROMs be remapped to K: and Z: if possible or assume that all the letters are of equal cost? I decided on the latter as I found this approach more inline with my goal. The end state is when the CDROMs comply with either K, Z, or Y. From your comments, I get the idea that perhaps separating this module into two separate ones is a preferred approach and more inline with Ansible way. win_cdrom_info My initial thought on win_cdrom_info return would be something very simple like this: number_of_virtual: int This approach with simplified win_cdrom_letter does not give you the ability to know which letters are free to use though. Sometimes “get the cd/dvd drive out of the way” is what might be needed and the other times you might need to be strict. I tried to encompass both possibilities in the current win_cdrom_letter implementation. My personal use cases are:
Disabling and enabling physical CDROMs is out of scope for this module. I believe CIM’s method to disable PnP devices is Win10/Server2016+ so it won’t be compatible with server 2012. So, as it stands, I am not sure what direction this should be heading. I would like to hear more opinions about this before I start doing any changes or abandon it all together. I will try to create a simple win_cdrom_info module, it can be useful by itself. |
I agree with what @jhawkesworth is saying here and this module is a lot more run this operation (rename) than be this. I see you've attempted to make things idempotent but in the end it just makes things a bit messy and hard to understand. I appreciate the work you've put into this so far but this isn't really what we are looking for. |
New windows module to change Windows description and License owner and organization.
Windows module to change Windows description and license owner and organization
@RusoSova this PR contains more than one new module. Please submit only one new module per pull request. For a detailed explanation, please read the grouped modules documentation |
New Windows module win_description
@RusoSova this PR contains the following merge commits: Please rebase your branch to remove these commits. |
The test
The test
|
@RusoSova If you are having issue with your branch you may wish to create a fresh branch and PR |
Hi! Thanks very much for your submission to Ansible. It sincerely means a lot to us that you've taken time to contribute. You've clearly put a lot of work and thought into this. There has been some great discussion as part of this PR Unfortunately, we're not sure if we want this feature in the program, and I don't want this to seem confrontational. Our reasons for this are:
However, we're absolutely always up for discussion. Since this is a really busy project, we don't always see comments on closed tickets, but want to encourage
In the future, sometimes starting a discussion on the development list prior to implementing a feature can make getting things included a little easier, but it's not always necessary. Thank you once again for this and your interest in Ansible! |
SUMMARY
New module for Windows to have cdroms remapped to the list of desired drives. The list of drive is provided in comma separated fashion. Module will ensure that all CDROMs are mapped to one of the letters provided. In case that are less letters provided than CDROMs, only number of CDROMs=number of drive letters will be changed.
Module can also dismount Windows virtual CDROMs as part of drive letter change or as a stand alone action.
ISSUE TYPE
COMPONENT NAME
win_cdrom_letter
ADDITIONAL INFORMATION
It's useful to know what your CDROM(s) are mapped as. I was tiered to rely on win_shell and win_command to invoke commands on my hosts. Does not look clean. I hope this will be useful for more people as well.