Created
March 12, 2015 14:44
-
-
Save mrlesmithjr/5f744f291a557b933c57 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| - hosts: 127.0.0.1 | |
| gather_facts: false | |
| connection: local | |
| user: remote | |
| sudo: true | |
| vars_prompt: | |
| - name: "vcenter_hostname" | |
| prompt: "Enter vcenter hostname" | |
| private: no | |
| default: "vcsa" | |
| - name: "vcenter_user" | |
| prompt: "Enter vcenter username" | |
| private: no | |
| - name: "vcenter_pass" | |
| prompt: "Enter vcenter password" | |
| private: yes | |
| # - name: "vm_name" | |
| # prompt: "Enter vm name to build" | |
| # private: no | |
| vars: | |
| # datacenter: | |
| # esxhost: | |
| # datastore: | |
| # network: | |
| vmtemplate: "Ubuntu 14.04 64-bit Server Template" | |
| # vmcluster: | |
| # resource_pool: | |
| notes: Created by Ansible | |
| tasks: | |
| # - name: Check for required variables | |
| # fail: msg="Must pass name to -e" | |
| # when: name is not defined | |
| # - name: Check for vSphere access parameters | |
| # fail: msg="Must set vcenter_user and vcenter_pass in a Vault" | |
| # when: (vcenter_user is not defined) or (vcenter_pass is not defined) | |
| - name: Create VM from template | |
| vsphere_guest: | |
| vcenter_hostname: "{{ vcenter_hostname }}" | |
| username: "{{ vcenter_user }}" | |
| password: "{{ vcenter_pass }}" | |
| guest: "{{ inventory_hostname }}" | |
| from_template: yes | |
| template_src: "{{ vmtemplate }}" | |
| # cluster: "{{ vmcluster }}" | |
| # resource_pool: "{{ resource_pool }}" | |
| vm_extra_config: | |
| notes: "{{ notes }}" | |
| # esxi: | |
| # datacenter: "{{ datacenter }}" | |
| # hostname: "{{ esxhost }}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment