"This works incorrectly, since it will put the containing directory,
what has been properly found with with_first_found inside the
destination."

Seems like you'd want the trailing slash here, since synchronize is in fact
just a thin wrapper around

local_action: rsync ...



On Mon, May 26, 2014 at 5:00 PM, Carlos A. Carnero Delgado <
carloscarn...@gmail.com> wrote:

> Hi,
>
> I (an Ansible newb) need to pass a directory of configuration files to
> remote nodes, so that the files on the remote end should *exactly*
> mirror what I have on the Ansible side. For instance, in my files
> directory (using a role) I have the following directories
>
>     etc/yum.repos.d-a.host.fqdn.example.com
>     etc/yum.repos.d-b.host.fqdn.example.com
>     etc/yum.repos.d-DEFAULT
>
> with CentOS repository definitions inside. Each machine's repository
> sources could be customized by making a new directory there with its
> FQDN attached to the file name. I'm using the sychronize module in a
> task like
>
>     - name: Repository configuration
>       synchronize: dest=/etc/yum.repos.d
>                    src="{{ item }}"
>                    recursive=yes delete=yes owner=no group=no
>       with_first_found:
>       - "etc/yum.repos.d-{{ ansible_fqdn }}"
>       - "etc/yum.repos.d-DEFAULT"
>
> This works incorrectly, since it will put the containing directory,
> what has been properly found with with_first_found inside the
> destination. This is a classic rsync "issue" easily solved by adding a
> "/" at the end. I have tried several combinations an the only one that
> I got working is by using src="{{ item }}/" instead of src="{{ item
> }}".
>
> I'm wondering if this is the intented behavior? Not world breaking at
> all, but it made me wonder; and, of course, I could ways resort to
> pure rsync.
>
> Alternatively, what's the best way to synchronize directories based on
> file name "templating"? The copy module works as expected but it is
> one way as it will never delete on the remote what is not in the
> source.
>
> Best regards,
> Carlos.
>
> --
> 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 post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/CAPjvz2mAkCm7Xc89e_k0uD5F2gm2EEF54KkJCmFr3VwsP6y6Tw%40mail.gmail.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+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgyuSb5wOBvMQUU6ubHY68oUHhaV4WYZ5Nok%3DAJf5KG-5g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to