{% set ignored = res.extend([{
     'hostname': 'app' + number|string,
     'ipaddress': ipaddress_base + '.' + number|string,
     'rmi_port': rmi_portbase|int + ( number * 10)
     }]) -%}
   {%- endfor %}
   {{ res }}
 tasks:
  - debug: var=host_info
/tmp $ ansible-playbook example.yml
 [WARNING]: provided hosts list is empty, only localhost is available
PLAY [127.0.0.1] ***************************************************************
TASK [setup] *******************************************************************
ok: [127.0.0.1]
TASK [debug] *******************************************************************
ok: [127.0.0.1] => {
  "host_info": [
    {
      "hostname": "app1",Â
      "ipaddress": "192.168.0.1",Â
      "rmi_port": 10010
    },Â
    {
      "hostname": "app2",Â
      "ipaddress": "192.168.0.2",Â
      "rmi_port": 10020
    },Â
    {
      "hostname": "app3",Â
      "ipaddress": "192.168.0.3",Â
      "rmi_port": 10030
    },Â
    {
      "hostname": "app4",Â
      "ipaddress": "192.168.0.4",Â
      "rmi_port": 10040
    },Â
    {
      "hostname": "app5",Â
      "ipaddress": "192.168.0.5",Â
      "rmi_port": 10050
    }
  ]
}
PLAY RECAP *********************************************************************