Hi

I currently have the Following Playbook that creates Windows Virtual 
Machines: 
If you need to do other tasks on the Virtual Machine; I'll recommend 
creating a Pipeline within a CI/CD platform:

For Example:
I have a number of Tasks 

   - Create Machine
   - Create AD Object
   - Join Domain
   - Install Applications On Server
   - Update SCCM 
   - Configure Second HardDrive on machine if Requested in Form:
   - Add DSC Agent onto Server


Tasks 4 will be Taken Care for you if you set AutoLogin:



---
    - name: Running Create Virtual Machine Playbook
      hosts: localhost
      gather_facts: false
      connection: local
      tasks:
      - name: Virtual Machine and customization
        vmware_guest:
          validate_certs: no
          hostname: "{{ vcenter }}"
          username: "{{ username }}"
          password: "{{ password }}"
          cluster : "{{ cluster }}"
          datacenter: "{{ datacenter }}"
          name: "{{ VM_Name }}"
          folder: /
          template: "{{ template }}"
          state: poweredon
          datastore: "{{ datastore }}"
          disk:
          - size_gb: 40
            type: thin
            datastore: "{{ datastore }}"
          networks:
          - name: "{{ network_name }}"
            ip: "{{ ip }}"
            netmask: "{{ netmask }}"
            gateway: "{{ gateway }}"
            dns_servers:
            - 10.10.10.10
            - 10.10.10.20
            type: static
          wait_for_ip_address: yes
          wait_for_customization: yes
          customization:
            hostname: "{{ VM_Name }}"
            dns_servers:
            - 10.10.10.10
            - 10.10.10.20
            dns_suffix:
            - localhost.com
            - ap.localhost.com
            domain: "{{ domain }}"
            autologon: yes
            password: "{{ local_pass }}"
            runonce:
            - powershell.exe -ExecutionPolicy Unrestricted wget https://raw.
githubusercontent.com/ansible/ansible/devel/examples/scripts/
ConfigureRemotingForAnsible.ps1 -OutFile C:\Windows\Temp\
ConfigureRemotingForAnsible.ps1
            - powershell.exe -ExecutionPolicy Unrestricted -File C:\Windows\
Temp\ConfigureRemotingForAnsible.ps1 -EnableCredSSP -DisableBasicAuth -
Verbose
          hardware:
            memory_mb: "{{ mb }}"
            num_cpus: "{{ cpu }}"
        delegate_to: localhost



-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/f04a8024-babd-4f03-b1f3-1c66fc6a16fd%40googlegroups.com.

Reply via email to