Hello Will Weber,
Thank you for your answer, certainly "helps more than confuses"
I still have questions about the IP address of the VM after being created
by Ansible.
Do you have any idea how to change the IP address of the VM and later add
this new host to the Ansible inventory file?

On Sun, Apr 1, 2018 at 1:14 PM, Will Weber <rwawe...@gmail.com> wrote:

> In my experience I've wanted to separate these kinda things out into a
> couple plays, since we’re dealing with logically different
> resources(hypervisor, dns, monitoring).
>
> Full disclosure, I haven’t used any of the described modules, but I’ve
> used somewhat similar patterns with ec2, security groups, firewalld, etc.
>
> 1. Provision a machine with the vmware module, and then use a register:
> guest statement to retain some of the variables returned from the
> provisioning in a variable called guest.
>
> It looks like the vmware_guest_module has some return values, though the
> documentation doesn’t get into what sort of fields they contain:
>
> https://docs.ansible.com/ansible/latest/modules/vmware_
> guest_module.html#return-values
>
> 2. Using the nsupdate module(https://docs.ansible.
> com/ansible/2.3/nsupdate_module.html), you will likely want to pass in
> the ip address that is hopefully contained within the guest variable
> retained in the last step, and then associate it to the name that you have
> in mind.
>
> 3. It looks like theres a handful of zabbix modules to choose from here:
> https://docs.ansible.com/ansible/latest/modules/
> list_of_monitoring_modules.html#zabbix
>
> However, I’ve never used zabbix — if there’s a way that you can tell
> zabbix “monitor service-name on address: 10.0.0.1” that would be the way I
> would recommend using the abstractions that the module provides.
>
> *Note*: if you plan to do this for more than one guest, it may make sense
> to consider abstracting this process into a role, so that you can specify
> the name to provision the machines with as part of your configuration data.
>
> An admittedly rough idea of the top of my head for some role data that
> provisions a guest at 10.0.3.5 called ’newnode.example.org’ on the
> nameserver at 10.0.1.5, using a vmware host at 10.0.2.5.
>
> ---
> - tasks:
>   - name: provision and enroll guest
>     include_role:
>       name: vmware-zabbix-role
>     vars:
>       nameserver: ’10.0.1.5'
>       nameserver_key_secret: ‘foo_bar_baz'
>       nameserver_zone: ‘example.org'
>       nameserver_record: ’newnode’
>       vmware_host: ’10.0.2.5’
>       vmware_template: ‘base-image’
>       vmware_guest_address: ’10.0.3.5'
>
>
> Hope this helps more than confuses,
>
> -Will
>
>
> On Apr 1, 2018, at 10:08 AM, Vamberto Rocha JR <vambert...@gmail.com>
> wrote:
>
> Hello everybody
>
> In my environment, I own VMware with vCenter, Bind as DNS server and
> Zabbix as a monitoring tool.
>
> What I would like to do with Ansible is to create a virtual machine from
> an already predefined template, add an entry in DNS, and add the VM in
> Zabbix monitoring.
>
> I know Ansible has modules for DNS, Vmware, and Zabbix, but has anyone
> done it yet?
>
> One of the many questions I have is regarding the IP address of the new
> VM, how do I change the IP address of the new VM using Ansible and already
> add in Ansible inventory?
>
> Thanks for all the help.
>
> --
> 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 ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/cf617a9c-3003-4260-a212-028d431c10b9%40googlegroups.
> com
> <https://groups.google.com/d/msgid/ansible-project/cf617a9c-3003-4260-a212-028d431c10b9%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 a topic in the
> Google Groups "Ansible Project" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/ansible-project/H2zmxuHg8oI/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> ansible-project+unsubscr...@googlegroups.com.
> To post to this group, send email to ansible-project@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/ansible-project/C59719F3-3C3C-4FC7-B04C-8B14938BEC44%40gmail.com
> <https://groups.google.com/d/msgid/ansible-project/C59719F3-3C3C-4FC7-B04C-8B14938BEC44%40gmail.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Att

Vamberto Rocha JR

<http://www.linkedin.com/in/vambertojr>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAF%3Dn%2BnONteaz289frGznrETQ-Nwi3GoYCRdN%2BUWypBpBzeabMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to