Excerpts from Michael DeHaan's message of 2014-07-30 07:51:22 -0400:
> The general situation is that change detection on a tree of 5000 files
> would be remarkably slow.  People think they want that, they do not.

Just though I'd point out that there is a pull request for this:
https://github.com/ansible/ansible/pull/5220

Slow may very well be a concern, though.

> AFAIK chmod/chown as shell tools do not have a return code option, settable
> by flag or otherwise that returns whether anything was changed.   If they
> did, we would be able to shell out to it and you could use a "changed_when"
> based on the return code result.

GNU chmod/chown actually *do* have something like this:

    -c, --changes       like verbose but report only when a change is made

If you combine this with '-R' and '-f' (for silent), then if there is anything
in stdout at all, you know a change has been made.

I've been using it like so while waiting for the aforementioned pull
request:

      - command: chmod -cfR u+X,g+X,o-w,o+X "{{ my_dir }}"
        register: perm_change
        changed_when: perm_change.stdout

Not ideal, in my opinion, but it works and could perhaps be used in
set_mode_if_different() method in the AnsibleModule class.  Not sure how
to deal with check mode using that method, though.
--
Morgan Hamill

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1406727779-sup-2611%40al.wesleyan.edu.
For more options, visit https://groups.google.com/d/optout.

Reply via email to