Jinja2 Configuration Concern with {{ fqdn_hostname }} and .conf file

Hello!

I have a configuration (.conf) file that I’m attempting to manipulate by adding the {{ fdqn_hostname }} ONLY for the serverName piece, the rest of the information like the SSL password is something that’s going to change across my hosts. How do I edit just the one line and keep the rest of the configuration file in tact? I’m concerned that if I use a jinja2 template and simply specify serverName = {{ ansible_fqdn }} that it’s going to write over the other information and simply keep that one line rendering the rest of the configuration file useless.

Thanks!

ons 2017-12-27 klockan 22:30 -0800 skrev Heather Luna:

I have a configuration (.conf) file that I'm attempting to manipulate
by adding the {{ fdqn_hostname }} ONLY for the serverName piece, the
rest of the information like the SSL password is something that's
going to change across my hosts. How do I edit just the one line and
keep the rest of the configuration file in tact?

Sounds like you are looking for the lineinfile module?

https://docs.ansible.com/ansible/latest/lineinfile_module.html

// Andreas