Search keyword in "host_fqdn" variable. If the value has "lab.com" keyword in it, it should directly store the value to "host_fqdn" again
or else it should add "lab.com" keyword to the value and store it to "host_fqdn" variable.
vars:
host_fqdn: server
host_fqdn: |
{% if 'lab.com' in {{ host_fqdn }} %}
{% host_fqdn = "{{ host_fqdn }}" %}
{% else %}
{% host_fqdn = "{{ host_fqdn }}.lab.com" %}
{% endif %}
Asked by Pandu
(149 rep)
Feb 19, 2019, 03:42 PM
Last activity: Jan 28, 2025, 09:06 PM
Last activity: Jan 28, 2025, 09:06 PM