Add asnsible_host for each member of a group.

Hi all

I have a group like this:

[webservers]
www[01:50].example.com

I would like to understand if there is a way to assign ansible_host variable for each member of the group like:

www01.example.com ansible_host=1.1.1.1
www02.example.com ansible_host=1.1.1.2
www03.example.com ansible_host=1.1.1.3

Obviously I would like to do it in one line, without define variable for each host like using regex

[webservers]
www[01:50].example.com ansible_host=1.1.1.[1:50]

No, hostvars do not support ranges, but you can define a single
hostvar for the range and use templating to get what you want.

www[01:50].example.com ansible_host={{'1.1.1.' +
inventory_hostname.split('.')[0]|regex_replace('www','') }}

^ have not tested it, but something like this should work.