paramaterized roles - how to do line break or pass args as a list?

I have tried figuring this out for a few hours now and can’t get it working…

Does anyone know how to properly format this so the code isn’t so wide?

  • hosts: 127.0.0.1

connection: local

gather_facts: no

roles:

  • { role: vsphere-guest, vm_name: ‘{{server1_hostname}}’, ip_addr: ‘{{server1_ip.stdout}}’, ip_mask: ‘{{ip_mask}}’, ip_gateway: ‘{{ip_gateway}}’, fqdn: ‘{{server1_hostname}}’, vm_memsize: ‘{{vm_memsize}}’, vm_numcpus: ‘{{vm_numcpus}}’, vcenter_username: ‘{{ vcenter[vsphere_environment].username }}’, vcenter_password: ‘{{ vcenter[vsphere_environment].password }}’, tags: [ ‘create_vms’, ‘create_vm1’ ] }

Thanks!

According to the docs
(https://docs.ansible.com/ansible/YAMLSyntax.html), I would try this:

...
  roles:
    - role: vsphere-guest
      vm_name: '{{server1_hostname}}'
      ip_addr: '{{server1_ip.stdout}}'

Can't test at the moment. And I am not sure about the "# Employee
records" example, which the docs show as abbreviated. In the example
there is a string martin in front of the whole dict.

Johannes

Your brilliant. That worked!

Here is the working example: