JYL,

Appreciate the recommendation. I should have mentioned that the Windows OS
is 2008r2. I did try this module before submitting and per the win_share
module docs and error message after run, this OS is not supported by the
win_share module.

James

On Wed, Aug 12, 2020 at 12:45 AM Jean-Yves LENHOF <jean-y...@lenhof.eu.org>
wrote:

> Hi,
>
> Perhaps using the module which does this, you'll have the idempotence ;-)
>
> https://docs.ansible.com/ansible/latest/modules/win_share_module.html
>
> Regars,
>
> JYL
>
>
> Le 11/08/2020 à 17:00, jhix...@gmail.com a écrit :
>
> New at Ansible and still trying to get the hang of setting conditional
> based upon output.
>
> I am setting Windows file shares with the below task. The initial run
> works fine; however, when you repeat the task, it fails stating that the
> shares already exist. How do I set a conditional that states if the network
> share already exists ignore, move on, rather than fail the run.
>
> Task:
>
> - name: Set File Shares
>   win_shell: |
>     net share WebContent="E:\Inetpub\wwwroot" /Grant:Everyone,READ
> /Grant:OSC\ServerAdministrator,CHANGE
>     net share LogFiles="F:\Inetpub\LogFiles" /Grant:Everyone,READ
>     net share Indexes="C:\Indexes" /Grant:Everyone,READ
> /Grant:OSC\ServerAdministrator,CHANGE
>     net share Components="C:\Component Services" /Grant:Everyone,READ
> /Grant:OSC\ServerAdministrator,CHANGE
>     net share Resources="C:\Inetpub" /Grant:Everyone,READ
> /Grant:OSC\ServerAdministrator,CHANGE
>
> Output:
>
> STDOUT:
>
> LogFiles was shared successfully.
>
> STDERR:
>
> The name has already been shared.
>
> More help is available by typing NET HELPMSG 2118.
>
> The name has already been shared.
>
> More help is available by typing NET HELPMSG 2118.
>
> The name has already been shared.
>
> More help is available by typing NET HELPMSG 2118.
>
> The name has already been shared.
>
> More help is available by typing NET HELPMSG 2118.
>
>
> MSG:
>
> non-zero return code
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/ee5cc554-c461-486f-88ca-13d18e1f940bn%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/ee5cc554-c461-486f-88ca-13d18e1f940bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/4320c0ef-bbf7-b564-47e5-f0476b0f16d5%40lenhof.eu.org
> <https://groups.google.com/d/msgid/ansible-project/4320c0ef-bbf7-b564-47e5-f0476b0f16d5%40lenhof.eu.org?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CACGpZwa2Cgvabv0TVHmBXggQUHrQcTmzUHiWw7TcwmXJNh1XKA%40mail.gmail.com.

Reply via email to