DependsOn and ansible.windows.win_dsc

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

Anyone got any ideas on this?

lördag 7 augusti 2021 kl. 16:13:47 UTC+2 skrev tony.h...@gmail.com:

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.