simple IP lookup plugin

15 views
Skip to first unread message

Michael Ströder

unread,
Feb 19, 2019, 3:31:27 PM2/19/19
to ansible...@googlegroups.com
HI!

Is there a simple example module how to implement an ansible
(connection) plugin for looking up an IP address for establishing the
SSH connection?

I have a deployment where no DNS entries are present prior to initial
host configuration, but I can access another (LDAP) database to query
the IP address by inventory_hostname.

Not sure whether I need a full-blown connection plugin [1] for this.

Ciao, Michael.

[1] https://docs.ansible.com/ansible/latest/plugins/connection.html

Kai Stian Olstad

unread,
Feb 19, 2019, 3:56:28 PM2/19/19
to ansible...@googlegroups.com
On 19.02.2019 21:31, Michael Ströder wrote:
> Is there a simple example module how to implement an ansible (connection) plugin for looking up an IP address for establishing the SSH connection?
>
> I have a deployment where no DNS entries are present prior to initial host configuration, but I can access another (LDAP) database to query the IP address by inventory_hostname.
>
> Not sure whether I need a full-blown connection plugin [1] for this.

It probably easier to create[1] you own inventory plugin[2] so you can populate the ansible_host with the IP.


[1] https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html
[2] https://docs.ansible.com/ansible/latest/plugins/inventory.html


--
Kai Stian Olstad

Michael Ströder

unread,
Feb 20, 2019, 7:13:12 PM2/20/19
to ansible...@googlegroups.com
On 2/19/19 9:56 PM, Kai Stian Olstad wrote:
> On 19.02.2019 21:31, Michael Ströder wrote:
>> Is there a simple example module how to implement an ansible
>> (connection) plugin for looking up an IP address for establishing
>> the SSH connection?>
> It probably easier to create[1] you own inventory plugin[2] so you
> can populate the ansible_host with the IP.

Yes, you're right. I have this working now after I figured out to set
'inventory_plugins' in ansible.cfg and some other details.

Thank you.

Ciao, Michael.
Reply all
Reply to author
Forward
0 new messages