robertdebock / ansible-role-zabbix_agent

Install and configure zabbix_agent on your system.
https://robertdebock.nl/
Apache License 2.0
9 stars 2 forks source link

ansible_fqdn or ansible_hostname in zabbix template - wrong value #4

Closed anutator closed 6 months ago

anutator commented 3 years ago

Server named changed for security reason

Describe the bug

You use ansible_fqdn in defaults/main.yml. It gives me the wrong value in zabbix config.

zabbix_agent_hostname: "{{ ansible_fqdn }}"

On Debian Linux with installed JitsiMeet conference I had to change /etc/hosts as part of configuring Jitsi. And it seems to me that fqdn was taken from that file. But I want to use name from hostname -f command in Zabbix. So I think I should change ansible_fqdn to ansible_hostname. Could you expain what is the difference?

# hostname -f
preprod-storage1

# hostname -d

# hostname
preprod-storage1

# hostnamectl
   Static hostname: preprod-storage1
         Icon name: computer-vm
           Chassis: vm
        Machine ID: bb25ed9b35ff4dc78b245b7f0d3bd21b
           Boot ID: 604c173a856f4dd0bb6aeaa71184d0a5
    Virtualization: vmware
  Operating System: Debian GNU/Linux 10 (buster)
            Kernel: Linux 4.19.0-17-amd64
      Architecture: x86-64

# cat /etc/hostname
preprod-storage1

# cat /etc/hosts
root@akd-isource-cimp-preprod-storage1:/home/toropova# cat /etc/hosts
127.0.0.1   localhost
10.27.1.25  preprod-storage1 meet.mysite.ru turn-meet.mysite.ru _xmpp-server._tcp.turn-meet.mysite.ru. _xmpp-server._tcp.mysite.mysite.ru

Extract from setup module:

        "ansible_fibre_channel_wwn": [],
        "ansible_fips": false,
        "ansible_form_factor": "Other",
        "ansible_fqdn": "meet.mysite.ru",
        "ansible_hostname": "preprod-storage1",
        "ansible_hostnqn": "",
        "ansible_interfaces": [
            "lo",
            "ens192"
        ],

Extract from other Linux machine. ansible_fqdn and ansible_hostname are the same.

        "ansible_fibre_channel_wwn": [],
        "ansible_fips": false,
        "ansible_form_factor": "Other",
        "ansible_fqdn": "preprod-db1",
        "ansible_hostname": "preprod-db1",
        "ansible_hostnqn": "",
        "ansible_interfaces": [
            "lo",
            "ens160"
        ],
robertdebock commented 6 months ago

The variable zabbix_agent_hostname is set in defaults/main.yml, meaning you can overwrite it with whatever value you would like to.