I've setup a way to provision a RHEL VM from a template using the 
VMware_guest module (shown below) I'm now trying to figure out away of 
shortening the AWX/Tower survey I have so that the user doesn't need to add 
so much info. (We currently have a script that provisions that is very 
bespoke and can do stuff like find the VLAN name from the IP given probably 
from vSphere API etc.)

The first item I would like to shorten is using the IP submitted via the 
survey then using some method to match that to a VLAN name, whether that's 
through vSphere API, or a Vars list or anything else i'm quite stuck.
Does anyone have any ideas to do this or any other tasks to reduce the 
amount of info required?


Our current script only needs: cluster name, size of VM (1_2 for 1 CPU, 2 
GB memory), hostname, IP, folder to store in and vSphere credntials



Playbook:

  - name: Create VM from template
    vmware_guest:
      validate_certs: False
      hostname: "{{ vcenter_hostname }}" 
      username: "{{ vcenter_user }}"
      password: "{{ vcenter_pass }}"
      cluster: "{{ cluster }}"
      folder: "{{ folder }}"
      datacenter: DCA
      name: "{{ vm_name }}"
      template: "{{ vmtemplate }}"
      disk:
      - size_gb: 50
        type: thin
        datastore: "{{ datastore }}"
      networks:
      - name: "{{ network }}"
        device_type: vmxnet3
        ip: "{{ vm_ip }}"
        netmask: "{{ netmask }}"
        gateway: "{{ gateway }}"
      hardware:
        num_cpus: "{{ vm_cpu }}"
        memory_mb: "{{ vm_memory }}"
      wait_for_ip_address: True
      state: present
    register: newvm

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-devel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to