"if there's any way to use the hostname of a server rather than it's IP to generate the file system tree when using the fetch module?"
Yeah, It should use the inventory name anyway. I'd file a bug on this one at github.com/ansible/ansible -- it's a small bug, and the workaround above will do, but it shouldn't be using conn.host as the host path, but rather "inventory_hostname". On Fri, Oct 24, 2014 at 9:19 AM, Michael Warkentin <[email protected]> wrote: > Thanks James, I'll give that a try! > > Sorry about the double-post as well - I didn't realize that the forum was > moderated, so I thought there was a glitch when I submitted my first > message. > > On Thursday, October 23, 2014 11:52:13 AM UTC-4, James Cammarata wrote: >> >> Hi Michael, >> >> One way you can get around this is to use the inventory_hostname variable >> in the dest= along with flat=yes, as follows: >> >> - hosts: all >> gather_facts: no >> tasks: >> - fetch: src=/etc/hosts dest="/tmp/{{inventory_hostname}}/" flat=yes >> >> As long as the inventory_hostname is actually a hostname and not an IP, >> this should do what you need. Beyond that, you can open a feature request >> PR on ansible-modules-core to allow using the inventory hostname instead of >> the connection address, when available. >> >> Hope that helps! >> >> On Tue, Oct 21, 2014 at 1:27 PM, Michael Warkentin <[email protected]> >> wrote: >> >>> Hello, I was wondering if there's any way to use the hostname of a >>> server rather than it's IP to generate the file system tree when using the >>> fetch module? >>> >>> Our ansible inventories are set up like so: >>> >>> aqua-notif-wrkr-01 ansible_ssh_host=12.34.56.789 >>> >>> This ends up generating a tree like this: https://s3.amazonaws. >>> com/snaps.michaelwarkentin.com/generate_server_list.py__ >>> waveapps_2014-10-21_16-17-17.png >>> >>> Would setting up /etc/hosts to map hostnames to IPs work, or are we >>> stuck with this? >>> >>> -- >>> 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 post to this group, send email to [email protected]. >>> To view this discussion on the web visit https://groups.google.com/d/ >>> msgid/ansible-project/ee6477b0-7b5d-4ae7-aa5b- >>> 33145f0e8e56%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/ee6477b0-7b5d-4ae7-aa5b-33145f0e8e56%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> 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 [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/0bd13c3d-0def-4528-afe4-ed97e74fcc81%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/0bd13c3d-0def-4528-afe4-ed97e74fcc81%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2BnsWgzrM%3DJG9SYDd_9mmAOZqvaX5UQCjrwifF%2B7hteJk7o%2Bag%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
