while this approach probably works, i'm not sure how to help you here.
what i typically do is use the add_host module. something like this:
- name: some playbook that does things
hosts: localhost
connection: local
...
...
...
tasks:
- name: add host to in memory inventory
add_host: hostname="new-vm{{some_var}}" ansible_ssh_host={{
vmware_guest_facts['guest_primary_ipaddress']}} ansbile_ssh_port=22
- name: some new playbook that does the work
hosts: "new-vm{{some_var}}
become: yes
tasks:
- name: copy some file
template: src={{src}} dest={{dest}}
i typed this without checking it's yaml syntax etc, but should give you a
rough idea of the approach we use.
Dann
On Thu, Jun 16, 2016 at 6:34 PM, Jeff Richards <[email protected]>
wrote:
> Hey Dann, I'm drawing a blank on the final piece in my puzzle here, maybe
> you can help(?). I've registered the vmware_guest_facts in a var and just
> want to iterate through it, for each hw_eth0.ipaddresses[0] ... e.g. this
> was my last (tortured) attempt:
>
> - name: copy new file into place
> delegate_to: "{{ item.[ {{ hw_eth0.ipaddresses[0] }} ] }}"
> template: src=xxxxxxx dest=/etc/xxxxxxxxxx
> with_nested:
> - "{{ vmware_guest_facts }}"
> become: yes
>
> What's the best way of doing this?
>
> Jeff
>
>
> On Wednesday, June 15, 2016 at 7:01:34 PM UTC-7, Dann Bohn wrote:
>>
>> Jeff,
>> You need to send the clone operation an customization spec in order to do
>> guest customizations on a vSphere VM. This is not included in the
>> vsphere_guest module.
>>
>> From what I can tell from reading the roadmap (
>> https://github.com/ansible/ansible/blob/devel/docsite/rst/roadmap/ROADMAP_2_2.rs)
>> the ansible folks would like to add such features to vsphere_guest in the
>> 2.2 release.
>>
>> In the meantime, you can look at a module I wrote to accomplish this:
>> https://github.com/whereismyjetpack/ansible_vcenter_module. It allows
>> you to send specific guest customization parameters to the clone operation,
>> the module is not ansibly (one of the first complaints I got), and requires
>> pyvmomi instead of pysphere. I've been using this in production for a
>> little over a year.. feel free to contact me if you have any questions, and
>> time permitting i'll do my best to answer them. I've tested this code on
>> vSphere 5.5 and 6.0.
>>
>>
>>
>> Dann
>>
>>
>>
>>
>>
>>
>>
>> On Wednesday, June 15, 2016 at 4:03:11 PM UTC-4, Jeff Richards wrote:
>>>
>>> Brian, I already have VMware tools installed, what options does that
>>> give me?
>>>
>>> Jeff
>>>
>>> On Wednesday, June 15, 2016 at 9:06:28 AM UTC-7, Brian Coca wrote:
>>>>
>>>> sadly vmware/vcenter gives no direct way to do this, you either need to
>>>> run a 'boot script' that does it or have the vmware guest tools installed.
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> ----------
>>>> Brian Coca
>>>>
>>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ansible-project/OFpCxHrmp6A/unsubscribe.
> To unsubscribe from this group and all its topics, 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/4b863eca-8453-4f9b-bb8a-8d9d56673745%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/4b863eca-8453-4f9b-bb8a-8d9d56673745%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CAB%2BbZBLDTJ1F%2Bwxu9R_HNDT_iCRmuOKoSGLqO3WD-_mDMuOsWg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.