Discussion:
Having problems with --exclude, --include with synchronize module using rsync_opts
Heath Henjum
2014-06-17 15:53:29 UTC
Permalink
Hi,

I was trying to do something using synchronize where I exclude some files
and include others, but it does not work like rsync:

So, this works with rsync,
- name: testrsync
local_action: command rsync -aH --include '[e\|p]*' --exclude '*'
prmfiles/output/{{ item.key }}/ {{ ansible_user_id }}@{{ inventory_hostname
}}:/export/home/oracle/hhenjum/heathtest/
when: oggaction == "prmfiles"
with_dict: dirprm | default({})

But, when I try to do this with synchronize, I can't get it to work. It
just passes through saying the step is "ok"... or no changes to do.

- name: testsync
synchronize: src=prmfiles/output/{{ item.key }}/
dest=/export/home/oracle/hhenjum/heathtest/ checksum=yes
rsync_opts="rsync_opts=--include='e*', --exclude='*'"
when: oggaction == "prmfiles"
with_dict: dirprm | default({})


If I don't have the double quotes around rsync_opts, then it gives me,
msg: unsupported parameter for module: --exclude


I imagine this is something with the wildcards? Also, I understand it
probably wasn't the intention for rsync_opts to handle everything you can
do with rsync.

It's not a huge issue. I just changed the deploy so that we can just sync
the whole directory rather than specific files, but I thought I'd check in
case it should work.

Thanks,
Heath
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7ee4f1ed-c09c-4132-b808-97994a202960%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Timothy Appnel
2014-06-17 16:29:55 UTC
Permalink
We are also having some problems at the day job with wild cards and the synchronize module however ours is tied to the src argument.

htttps://github.com/ansible/ansible/issues/7728

I've been looking when I have a chance but haven't figured out what's going wrong. I just know the command Ansible is reporting it runs works fine on the command line. Remove the wildcard and Ansible runs. Put it back in and it fails.

<tim/>
Michael DeHaan
2014-06-17 19:18:07 UTC
Permalink
Don't know, any debugging would be appreciated.
Post by Timothy Appnel
We are also having some problems at the day job with wild cards and the
synchronize module however ours is tied to the src argument.
htttps://github.com/ansible/ansible/issues/7728
I've been looking when I have a chance but haven't figured out what's
going wrong. I just know the command Ansible is reporting it runs works
fine on the command line. Remove the wildcard and Ansible runs. Put it back
in and it fails.
<tim/>
--
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
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/18295ccd-d544-4d10-9e75-a32c497a51e5%40googlegroups.com
.
For more options, visit https://groups.google.com/d/optout.
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgxL9xXmbf8YJR7SnxxMBi-q0h%3DtYeq7hsPRGa8uaFaTdg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Timothy Appnel
2014-06-18 15:11:30 UTC
Permalink
I found what the problem is though I don't know what the right solution is.

https://github.com/ansible/ansible/pull/7820

Essentially safe shell module causes wildcards to be treated as literals
with rsync. As long as that is the case you can't use wildcards with sync
module, but you can't do that either as stated in the pull request comments
so I'm at a bit of a loss how to resolve this issue.
Post by Michael DeHaan
Don't know, any debugging would be appreciated.
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5cc65bdb-9455-4667-9bfa-5cd6db678dfc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Heath Henjum
2014-06-24 15:58:26 UTC
Permalink
I read the description from pull 7820, and it makes sense. For my
situation, I'm pretty sure with_fileglob would work, but I haven't tested
it.

Thanks Tim for finding the issue.
Post by Heath Henjum
Hi,
I was trying to do something using synchronize where I exclude some files
So, this works with rsync,
- name: testrsync
local_action: command rsync -aH --include '[e\|p]*' --exclude '*'
}}:/export/home/oracle/hhenjum/heathtest/
when: oggaction == "prmfiles"
with_dict: dirprm | default({})
But, when I try to do this with synchronize, I can't get it to work.
It just passes through saying the step is "ok"... or no changes to do.
- name: testsync
synchronize: src=prmfiles/output/{{ item.key }}/
dest=/export/home/oracle/hhenjum/heathtest/ checksum=yes
rsync_opts="rsync_opts=--include='e*', --exclude='*'"
when: oggaction == "prmfiles"
with_dict: dirprm | default({})
If I don't have the double quotes around rsync_opts, then it gives me,
msg: unsupported parameter for module: --exclude
I imagine this is something with the wildcards? Also, I understand it
probably wasn't the intention for rsync_opts to handle everything you can
do with rsync.
It's not a huge issue. I just changed the deploy so that we can just sync
the whole directory rather than specific files, but I thought I'd check in
case it should work.
Thanks,
Heath
--
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+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/602f524d-7689-4c06-b0be-881de47eb9b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...