Your brilliant. That worked!
Here is the working example:
---
- hosts: 127.0.0.1
connection: local
gather_facts: no
roles:
- { role: dns-record, start_ip: '{{ vm_start_ip }}', end_ip: '{{
vm_end_ip }}', server_name: '{{ server1_hostname }}' }
tags:
- create_dns
- hosts: 127.0.0.1
connection: local
gather_facts: no
vars_files:
- provision_vault.yml
pre_tasks:
- name: get server1 ip
command: dig +short '{{ server1_hostname }}'
register: server1_ip
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' ]
So much cleaner :)
Thanks again!
On Wednesday, May 18, 2016 at 4:59:48 PM UTC-4, Eric McAlvin wrote:
>
> 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!
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f2b06306-d0fd-46d7-88ea-c05672d3deab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.