DependsOn and ansible.windows.win_dsc

65 views
Skip to first unread message

tony.h...@gmail.com

unread,
Aug 7, 2021, 10:13:47 AM8/7/21
to Ansible Project
Hello!

I'm trying to figure out how I can write dependsOn with the win_dsc module. As far as I understand it, the dsc configuration itself isn't started with a name, see https://github.com/ansible-collections/ansible.windows/blob/bf3fbf8ac02241c9e7e4f2111edb642e4d8555ad/plugins/modules/win_dsc.ps1#L456.

This makes it so I cannot reference the configuration name for DependsOn parameter, https://docs.microsoft.com/en-us/powershell/scripting/dsc/configurations/resource-depends-on?view=powershell-7.1.

Is there anyone who knows how this works in Ansible?

Best regards
Tony

tony.h...@gmail.com

unread,
Aug 21, 2021, 12:17:55 PM8/21/21
to Ansible Project
Anyone got any ideas on this? 

jbor...@gmail.com

unread,
Aug 22, 2021, 3:20:54 PM8/22/21
to Ansible Project
You cannot. Each win_dsc task is an adhoc implementation of a DSC resource and they have no idea about other DSC tasks you may have invoked. Ansible tasks are run sequentially so running 2 DSC tasks after each other will ensure both are run and the 2nd is dependent on the first. If you wish to skip tasks use the when condition on the Ansible task itself.
Reply all
Reply to author
Forward
0 new messages