That's not really a solution if I have 100 playbook hosts and 5 hosts where I will deploy files in this way. [email protected] schrieb am Dienstag, 8. März 2022 um 15:00:46 UTC+1:
> On Tue, 8 Mar 2022 04:50:59 -0800 (PST) > "[email protected]" <[email protected]> wrote: > > > Hi, I have the following task: > > > > - ansible.builtin.copy: > > src: "{{ item }}" > > dest: /tmp/ > > with_fileglob: "files/tmp/{{ inventory_hostname }}/*.yaml" > > > > Directory files/tmp/bar/ contains yaml files for host *bar*. > > Directory files/tmp/foo/ doesn't exist because host *foo* should not > > receive any files with this task. > > > > If I run this task on hosts *bar* and *foo*, I always get a warning: > > [WARNING]: Unable to find 'files/tmp/foo' in expected paths (use -vvvvv > to > > see paths) > > The simplest solution is to create empty directories if missing > > - ansible.builtin.file: > state: directory > path: "files/tmp/{{ inventory_hostname }}" > delegate_to: localhost > > - ansible.builtin.copy: > src: "{{ item }}" > dest: /tmp/ > with_fileglob: "files/tmp/{{ inventory_hostname }}/*.yaml" > > > -- > Vladimir Botka > -- 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/cdc2b70e-b162-4632-93fc-9239ae9fbf58n%40googlegroups.com.
