Re: [ansible-devel] split FQDN

2019-10-27 Thread Matti Herrmann
Hi Andreas, that's exactly what I need. In [12]: s.split('.', 1) Out[12]: ['host', 'sub1.sub2.example.com '] Thanks. Am Sonntag, 27. Oktober 2019 18:25:04 UTC+1

Re: [ansible-devel] split FQDN

2019-10-27 Thread Matti Herrmann
uld work for you: > >- name: "set new hostname fact" > set_fact: > my_host: "{{ inventory_hostname.split('.')[0] }}.{{ > inventory_hostname.split('.')[1] }}.{{ inventory_hostname,split('.')[-1] }}" > > On Sat,

[ansible-devel] split FQDN

2019-10-25 Thread Matti Herrmann
Hello, I wan´t to split the hostname of my inventory hostnames. The hostnames have two or three subdomains. For Exampel "host.sub1.sub2.domain" I need two splits. One bevor the first dot (in our example: host) and one after the first dot. (sub1.sub2.domain). I tried with {{ HOST.split(".")[0] }}