0

I am trying to salt librenms. When replacing the original librenms config file, I want the ServerName to be FQDN instead of Ip address. network.get_fqdn returns IP address as well.

{%- from "librenms/map.jinja" import librenms with context -%}
<VirtualHost *:80>
  DocumentRoot /opt/librenms/html/
  ServerName {{ network.get_fqdn }}
# ServerName {{ grains['ipv4'][0] }}
  AllowEncodedSlashes NoDecode
  <Directory "/opt/librenms/html/">
    Require all granted
    AllowOverride All
    Options FollowSymLinks MultiViews
  </Directory>
</VirtualHost>

Help would be appreciated.

1 Answers1

1

You could try using:

  • grains|['minion_id'], but it depends on the naming rules of the minions ;
  • grains|['nodename'], but it will be a short name ;
  • a grains or pillar dedicated key.

I would avoid using:

  • grains['domain'], which can be empty ;
  • grains['fqdn'], which depends on the network settings.

Otherwise, and if it matches your needs, you can also try without the ServerName setting.