Instead of running the find command via `command`, switch to using the
`find` module, register the result, then use the `file` module, looping the
previous results, to set permissions on the directories.



On Thu, May 27, 2021 at 9:02 AM Nicola L. <[email protected]> wrote:

>
> Hi,
> this task breaks the idempotence of my role:
>
> - name: Set directories permissions for production installation
> command: find /opt/tomcat -type d -exec chmod -c 2750 {} \;
> register: find_chmod_result
> changed_when: 'find_chmod_result.stdout | length > 0'
>
> The command is selecting all the folders (and not the files) located under
> /opt/tomcat and it applies them the permissions 2750.
>
> Is there a way to express the same thing without breaking the idempotence?
>
> Nicola
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/e264e896-18fb-479d-9b0e-e6b62649d117n%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/e264e896-18fb-479d-9b0e-e6b62649d117n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Matt Martz
@sivel
sivel.net

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9VgqyDTQO4dkSX1tHr5aV-tZiirLRdafbVzj-w0iRPWA%40mail.gmail.com.

Reply via email to