# DependsOn and ansible.windows.win\_dsc

**URL:** <https://forum.ansible.com/t/dependson-and-ansible-windows-win-dsc/35597>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [August 7, 2021, 2:13pm UTC](https://forum.ansible.com/t/dependson-and-ansible-windows-win-dsc/35597 "2021-08-07T14:13:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Hogsten](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@Tony\_Hogsten](https://forum.ansible.com/u/Tony_Hogsten)\
**Post date:** [August 7, 2021, 2:13pm UTC](https://forum.ansible.com/t/dependson-and-ansible-windows-win-dsc/35597/1 "2021-08-07T14:13:46Z")

</div>

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](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](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

---

<div class="post-metadata">

**Author:** ![Tony\_Hogsten](https://avatars.discourse-cdn.com/v4/letter/t/e5b9ba/32.png) [@Tony\_Hogsten](https://forum.ansible.com/u/Tony_Hogsten)\
**Post date:** [August 21, 2021, 4:17pm UTC](https://forum.ansible.com/t/dependson-and-ansible-windows-win-dsc/35597/2 "2021-08-21T16:17:55Z")

</div>

Anyone got any ideas on this?

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

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [August 22, 2021, 7:20pm UTC](https://forum.ansible.com/t/dependson-and-ansible-windows-win-dsc/35597/3 "2021-08-22T19:20:54Z")

</div>

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.
