fetch with_fileglob won't get files

779 views
Skip to first unread message

Makimoto Marakatti

unread,
Jun 19, 2014, 6:54:29 AM6/19/14
to ansible...@googlegroups.com
Hi all

I have a play like this:

---
- hosts: group
  sudo
: True
  gather_facts
: no
  tasks
:
   
- name: actually fetch files
      fetch
: src={{ item }} dest=/ansible/deployment/files/backup/group/
      with_fileglob
: /etc/yum.repos.d/*

Which seems to run successfully:


$ ansible
-playbook fetch_files_from_server.yml -s

PLAY
[pheasant] ***************************************************************

TASK
: [actually fetch files] **************************************************
ok
: [node1] => (item=/etc/yum.repos.d/CentOS6.4-x86_64.repo)
ok
: [node2] => (item=/etc/yum.repos.d/CentOS6.4-x86_64.repo)
ok
: [node1] => (item=/etc/yum.repos.d/scl.repo)
ok
: [node3] => (item=/etc/yum.repos.d/CentOS6.4-x86_64.repo)
ok
: [node2] => (item=/etc/yum.repos.d/scl.repo)
ok
: [node1] => (item=/etc/yum.repos.d/CentOS6.4-updates-x86_64.repo)
ok
: [node2] => (item=/etc/yum.repos.d/CentOS6.4-updates-x86_64.repo)
ok
: [node3] => (item=/etc/yum.repos.d/scl.repo)
ok
: [node3] => (item=/etc/yum.repos.d/CentOS6.4-updates-x86_64.repo)

PLAY RECAP
********************************************************************
node1                  
: ok=1    changed=0    unreachable=0    failed=0  
node2                  
: ok=1    changed=0    unreachable=0    failed=0  
node3                  
: ok=1    changed=0    unreachable=0    failed=0  

But there are no files in the dest path.

What am I doing wrong here??

thanks!

Michael DeHaan

unread,
Jun 19, 2014, 5:20:35 PM6/19/14
to ansible...@googlegroups.com
I'd perhaps run this with -vvv for starters, and then maybe show the command you are showing to show there aren't any files?





--
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-proje...@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/b106e165-20b1-4779-9b4e-1afb11bb2b40%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Brian Coca

unread,
Jun 19, 2014, 5:45:39 PM6/19/14
to ansible...@googlegroups.com
with_fileglob is running on the 'master' not on the target server, so unless they have the same files this won't work.

you might want to run a shell: find + register a var for use in the fetch

Michael DeHaan

unread,
Jun 19, 2014, 5:47:22 PM6/19/14
to ansible...@googlegroups.com
Yep, that's true!




On Thu, Jun 19, 2014 at 4:45 PM, Brian Coca <bria...@gmail.com> wrote:
with_fileglob is running on the 'master' not on the target server, so unless they have the same files this won't work.

you might want to run a shell: find + register a var for use in the fetch

--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Makimoto Marakatti

unread,
Jun 20, 2014, 3:36:14 AM6/20/14
to ansible...@googlegroups.com
Hi Brian, Michael

Been reading about "with_fileglob", and yes, it apparently only works in the localhost or primary node (gotta be PC nowadays! :D ). But why does it then show me the right files in the remote boxes?? And cherry on top, it reports "ok" for the task. That's confusing to say the least.

I did try doing the register/debug thing. Could not get it working. There are plenty of examples on this list for instance, but I guess I lack a python foundation...

In any case, I finally resorted to the proven shell & rsync method. I had my files backed up in minutes.

Thanks both for your time.

Michael DeHaan

unread,
Jun 20, 2014, 4:55:35 PM6/20/14
to ansible...@googlegroups.com
If you don't glob any files, the number of files globbed is 0.

As for right files on right boxes, I don't know what you mean by that.


--
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-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Makimoto Marakatti

unread,
Jun 20, 2014, 6:44:59 PM6/20/14
to ansible...@googlegroups.com
Hi

Sorry, I meant that it actually sees the files. Those files do actually exist in the target boxes.
So it seems strange or counterintuitive, that it can actually see the files, can 'stat' them, but can not get them...

As I said in my previous post, files are now backed up in any case. Now I can overwrite them with templates.... :)

thanks
Reply all
Reply to author
Forward
0 new messages