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 <mediocregop...@gmail.com> 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 ansible-project+unsubscr...@googlegroups.com. > To post to this group, send email to ansible-project@googlegroups.com. > 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 the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. 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.