-
Notifications
You must be signed in to change notification settings - Fork 23.7k
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 module: win dsc #24872
New module: win dsc #24872
Conversation
The test
The test
The test
|
The test
The test
The test
|
Looking closer at the tests, seems we don't have any targets with WMF5.0 or 5.1 on them. |
The test
The test
|
I like it if it gets put in, use it quite often! |
Thanks @daBONDi , it was about time to get this cleaned up and PRed in ;-) |
#Set-StrictMode -Off | ||
|
||
$params = Parse-Args $args -supports_check_mode $true | ||
$result = New-Object psobject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using normal hashtables these days for the result object.
$result = @{
changed= $false
}
$CheckMode = $True | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use this nowadays:
$check_mode = Get-AnsibleParam -obj $params -name "_ansible_check_mode" -type "bool" -default $false
It helps if we can keep the same statements/variable naming for the different modules.
|
||
} | ||
|
||
$resourcename = Get-Attr -obj $params -name resource_name -failifempty $true -resultobj $result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also use Get-AnsibleParam here.
#Always return the name | ||
set-attr -obj $result -name "resource_name" -value $resourcename | ||
set-attr -obj $result -name "attributes" -value $Attributes | ||
set-attr -obj $result -name "reboot_required" -value $null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could be simple assignments:
$result['resource_name'] = $resourcename
$result['attributes'] = $Attributes
$result['reboot_required'] = $null
the ansible parameters would be cred_username and cred_password. | ||
These will be used to inject a credential object on the fly for the DSC resource. | ||
options: | ||
resource_name: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would simply call this name
, but keep resource
or resource_name
as alias. (Maybe this is not possible because of conflicts in that namespace ?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "name" is ambigous, as there might also be a "name" param sent into the module (which we rewrite as stated in the docs). I think it's best to avoid "name" altogether on this - and there's a very good chance someone down the line suggests to allow the "name" parameter to be passed in to the underlying dsc resource without rewriting it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
path="C:\Temp\zipfile.zip" | ||
destination="C:\Temp\Temp2" | ||
''' | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The windowsfeature example from the integration tests belongs in this section too. And to be honest, I think we may need a complete section in the documentation related to DSC, real-life examples, etc... This will become the main bulk of what people will be doing with Ansible on Windows going forward.
A full library of common tasks (alternatives to Unix modules) would be very welcome. Something users can easily add examples to, or annotate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, I was thinking about that - we'll probably need a separate doc page related to dsc. I'll ask @nitzmahone what he thinks. In the meantime I'll incorporate your suggestions, thanks for reviewing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's on the agenda for London, so I am confident that once we have decided about the plan, we can collaborate quickly on the implementation. Exciting times !
I don't think it works that way, you need 2 shipits from maintainers for it to be merged automatically. And for new modules that's not possible. Unless we add ourselves in advance to the MAINTAINERS document ;-) |
bot_status |
waiting_on: maintainer |
Just reading about the process on https://github.com/ansible/community/blob/master/PR-FLOW.md, but it doesn't completely line up with how the bot labels things. Not sure if I should ping @nitzmahone , just merge it myself (having received two shipits) or something else. Can't wait to squash this madness :-) |
@trondhindenes I've been adding some ideas to the AnsibleFest London EtherPad wrt. contributions and automerging, if you have ideas of improving the workflow as well, share them :-) 2000 open issues and almost 1200 PRs is not looking good :-( |
Yeah, I think we're at the point that we need to just get it out there for folks to start playing with- I'm sure there will be things to change down the line, but hopefully this can solve some pain for folks that have access to DSC resources that do things Ansible doesn't. |
sweet, thanks guys! Big step! |
Thank YOU! Stoked to get it shipped! |
If we finish everything we planned to do at AnsibleFest in London, we can drink MORE beer ! |
Delighted this is in! Now need big excuse to start using it. |
I am seeing an error with a basic Dsc Resource "File":
Output:
The problem seems to be that there are DscResources that have no module. For File it is empty? |
File is weird, it has no module. Wont fix. Ill add it the documentation |
I guess that if we're going to add a DSC section to the windows documentation, it's time to start splitting up the Windows docs. It's already one huge document. I'll add it to the WWG agenda. |
@trondhindenes I have a patch that allows you to optionally set An example:
|
Good point wernerb. Please submit pr to this repo, I won't maintain the "private" version any longer (i'll add some text regarding that in that repo) |
I just got here via Trond's message on the old repo. :-) So glad that this is now merged into ansible. I'm quite a heavy user of this module. I'll have some time to test all my playbooks with this merged version of the module. I hope I won't have to open too many issues. ;-) 2000 open issues is quite a lot. |
@cwegener Can we use your expertise for helping with the DSC documentation ? We would like to have a section, either in the docs or on a wiki, with real-world use-cases, examples and tips-and-tricks to make this attractive to Windows admins. Good quality roles we can point to would be an asset too. |
@dagwieers I'd be happy to help with documentation. I'm not sure what the timeframe for the 2.4 release is though (assuming that the DSC documentation should be ready for the release). Depending on what the timeframe is, I can commit to writing up some use cases and examples. I do have a couple of SQL Server playbooks for ansible+dsc that I should be able to share as an example. |
@cwegener I'm not sure what @trondhindenes had planned with this but it may be useful to add some of your examples or whatever you think is relevant to https://github.com/ansible/community/wiki/Windows%3A-documentation. That way we can collate it all at the end or add it to the eventual PR that will be there. |
@cwegener the timeframe/dates for ansible 2.4 are here: https://github.com/ansible/ansible/blob/devel/docs/docsite/rst/roadmap/ROADMAP_2_4.rst |
@jborean93 Thanks for the link to the wiki. That sounds like a good starting point. I'm pretty new at contributing documentation to ansible. I will need to figure out how to use Github Wikis though. I've never used them before. |
I have a ton of examples from our production code aswell, happy to contribute. |
SUMMARY
New module: win_dsc
ISSUE TYPE
COMPONENT NAME
win_dsc
ANSIBLE VERSION
ADDITIONAL INFORMATION
This module has been sitting in a personal repo, but as its becoming popular it makes sense to add it to Ansible core.
The module allows execution of DSC resources, and takes a dynamic range of parameter depending on the underlying DSC resource.