dj-wasabi / ansible-zabbix-agent

Installing and maintaining zabbix-agent for RedHat/Debian/Ubuntu/Windows/Suse.
https://galaxy.ansible.com/dj-wasabi/zabbix-agent
MIT License
327 stars 248 forks source link

IP adresse & host zabbix #248

Closed steevivo closed 5 years ago

steevivo commented 5 years ago

Hi,

I would like to know if is it possible to use my Floating IP in my "hosts" file and not the private IPV4 address with ansible_default_ipv4, what is the best way for that ?

PS : I'm using API for create host with the module zabbix_host

Thanks

dj-wasabi commented 5 years ago

Hi @steevivo

Does something like this work for you:

- name: "Get IP Server"
  shell: grep $(hostname) /etc/hosts | awk '{ print $1 }' | tail -n 1
  register: ip_address

?

steevivo commented 5 years ago

Hi, Some testing..

Thx