Formatting with set_fact

Hi,

While using set_facts , I am combining a hostname and dns name .
myhost = linuxhost1
mydns = example.com.

while combining them with set_fact

ansible.builtin.set_fact:
my_fqdn: “{{myhost}}.{{mydns}}”

This gives the desired output of “linuxhost1.example.com.”
The last dot can be cut with [:-1] with debug , however I want to set this in set_fact itself as I am trying to write the FQDN without a dot to the inventory file.

This should do the trick:

“{{myhost}}.{{mydns | trim(‘.’)}}”

Hi all,
Where can I see the available options like

trim(‘.’) which i can use in playbook.

Warm Regards,
Abhi

Thanks … It worked

https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_filters.html
https://jinja.palletsprojects.com/en/3.1.x/templates/#builtin-filters