D
D
Drno2022-01-31 10:15:37
linux
Drno, 2022-01-31 10:15:37

How to substitute hostname in zabbix?

Good afternoon. There are many machines. I want to upload the Zabbix-agent config to them through ansible.
And the config has a hostname parameter - how can I substitute it / replace it by putting the hostname of the machine there?
I understand that with the help of let's say sed, but I don't know how to form the replacement string correctly

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vreitech, 2022-01-31
@Drno

Since you need to not only copy the file to the target machine, but also change certain content in it, then use the Ansible template module .
The machine name can be inserted into the config template using the special variable {{ ansible_hostname }} substitution construct .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question