Both command do nothing because the blob set contains no file. It contains only directories and and with_fileblob iterates only on files.
How could I synchronize the XXX.git directories with the remote server ?
Brian Coca
unread,
Jan 20, 2016, 1:31:14 PM1/20/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
with_pipe: find /home/git/*.git -type d
--
Brian Coca
Christophe Meessen
unread,
Jan 21, 2016, 5:24:10 AM1/21/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Thank you very much Brian. This was incredibly useful.
I had to do a small change to your suggested command otherwise it lists all the directories found recursively. I added the maxdepth option. This is for people looking later for the answer:
with_pipe: find /home/git/*.git -type d
-maxdepth 0
Christophe Meessen
unread,
Jan 21, 2016, 5:54:58 AM1/21/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
In fact it is still not right. The correct loop instruction is
with_lines: find /home/git/*.git -type d
-maxdepth 0
This will make one iteration per command output line and assign it to item.
Brian Coca
unread,
Jan 21, 2016, 8:49:35 AM1/21/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
if you only want the .gits:
with_lines: find /home/git/ -name '*.git' -type d -maxdepth 0
--
Brian Coca
Christophe Meessen
unread,
Jan 21, 2016, 9:19:13 AM1/21/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Yes I only want the .git. Indeed your way to invoke find is more correct. However it still need a change to work on my Ubuntu computer. This one worked.
find /home/git/ -maxdepth 1 -name "*.git" -type d
The maxdepth option should be moved to front and its value should be 1. Your way to invoke find is indeed better than mine