Probably just missed something basic in the docs, but for each host
foo.internal.company.com, I'd like to create a /etc/ddclient.conf file
containing the string "foo." What's the best way to do this? I'm
thinking templates, but not sure how to get just the first component
of inventory_hostname. Should I be defining filter plugins for this?
(The note on filter plugins in the docs was pretty brief - is there a
place in my project I can define filter plugins?) Thanks.
{{ inventory_hostname_short }} is already available for this purpose for the current host you are operating on, but if you need to list more than one host or use this trick for other variables, you can do things like:
{{ variable.split(“.”)[0] }}