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

14 views
Skip to first unread message

Heather Luna

unread,
Dec 28, 2017, 1:30:32 AM12/28/17
to Ansible Project
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!

Andreas Olsson

unread,
Dec 28, 2017, 1:52:37 AM12/28/17
to ansible...@googlegroups.com
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
Reply all
Reply to author
Forward
0 new messages