The problem with dns, like the /etc/hosts problem you mentioned, is we'd
have to run ansible for any inventory changes. Which isn't the end of the
world, I was just hoping there might be a cleaner solution. I have the
inventory locally, I have ansible which can read and understand that
inventory, I was hoping I could get the information I need directly from
ansible rather than having ansible essentially cache it in another place.
It's kind of a weird request, so I understand if there isn't a great
solution. Thanks for the response!

On Wed, Aug 19, 2015 at 2:39 PM Michael Peters <[email protected]>
wrote:

> Sounds like you're wanting to be able to ssh to a machine based on
> it's name instead of it's ip address. DNS is the obvious answer.
>
> If not that, then maybe create an ansible playbook that generates an
> /etc/hosts file for your control server based on the servers in the
> inventory. Then you can just use the hostname. The downside of that is
> you have to re-run the playbook if any IPs change.
>
> On Wed, Aug 19, 2015 at 4:26 PM, Brian Picciano
> <[email protected]> wrote:
> > Hi there! Sorry if this has been asked before, I searched quite a bit and
> > wasn't able to find anything of this nature.
> >
> > We have our ansible repo with our inventory and all of that fun stuff.
> > Currently our inventory is static, but at some point in the future we''ll
> > likely switch to a dynamic inventory. At the moment when I go to ssh into
> > any of our machines I go to our inventory file which has all the ips,
> copy
> > the one I want, and paste it into an ssh command. This is kind of a pain.
> > I'm wondering if there's a way to use ansible to start an ssh session. If
> > not ansible actually starting a process, a way at least for ansible to
> tell
> > me ip it would use to connect to any given name of a machine. I could
> easily
> > write a script which just greps through our file, but then this script
> would
> > get rewritten (and likely become a lot more complicated) when we switch
> to a
> > dynamic inventory. It also just makes more sense for just ansible to
> > understand the inventory, and to provide the information about it to
> other
> > processes which need it (at least in my mind).
> >
> > Hopefully someone has an answer, and thanks!
> >
> > --
> > 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/f7672ab9-3be1-40d6-9b3f-e814de5f6956%40googlegroups.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/fHKQPs38POI/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAJQqANfJjQ7gvBpdbE-_2KDYSL1hG8T3Bo5X0XWXMLcaD9PfAw%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 [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/CAO2gzOvTfsDsCAzPhZiuYffGBmOMzEbyDgoL1YuVLm51-tGUJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to