> I'm looking for an method by which I can have a look on all of my
> 'Ansible-Clients' for an specific IP-Address.
Try this
- hosts: all
gather_facts: true
tasks:
- debug:
var: ansible_all_ipv4_addresses
HTH,
-vlado
Hi vlado,
thanks for your reply. But I'm looking for an method to grep for an Ip-address which is set in any configuration file on
every of my 'Ansible-Clients.
Do you also have an idea how I can configure this with Ansible?
Hello Matthias,
it is unclear what you want to achieve with these ip addresses, but you can get a list of the configuration files with
the find module. Than you can use the command module to retrieve IP addresses with Unix grep command.
Be aware that you likely need regular expressions for both IPv4 and IPv6 adresses. Also you probably get false positives.
thanks for your fast reply and sorry for the misleading problem. My task is to find out if an old relay-host with the IP-Address “192.168.110.45” is configured on
any of the hosts which are in my hosts-List configured. And therefore I thought that I can do it with an ‘grep’ on every system.
But it seems not to be so easy :(…
Hope, it’s now clearer what I wanna configure and someone can help me!?
Regards,
Matthias
Hello Matthias,
it is unclear what you want to achieve with these ip addresses, but you can get a list of the configuration files with
the find module. Than you can use the command module to retrieve IP addresses with Unix grep command.
Be aware that you likely need regular expressions for both IPv4 and IPv6 adresses. Also you probably get false positives.
thanks for your fast reply and sorry for the misleading problem. My task is to find out if an old relay-host with the
IP-Address "192.168.110.45" is configured on
any of the hosts which are in my hosts-List configured. And therefore I thought that I can do it with an 'grep' on every
system.
But it seems not to be so easy :(....
Hope, it's now clearer what I wanna configure and someone can help me!?
Can you give an example how such an entry looks like in the configuration file?
And a relay host can be configured as domain name instead of an IP.