Difference between revisions of "Erstellen VM"
Line 1: | Line 1: | ||
− | |||
--- | --- | ||
Line 100: | Line 99: | ||
sudo: yes | sudo: yes | ||
tags: mac | tags: mac | ||
− | |||
− |
Revision as of 08:41, 23 October 2019
--- - hosts: all
gather_facts: false connection: local user: remote
vars: vcenter_hostname: 'IP' vcenter_user: 'administrator@testlab.lan' vcenter_pass: 'PASSWORD' datacenter: 'testlab' esxi_host: 'IP' notes: 'Created by Ansible' tasks: - vsphere_guest: validate_certs: False vcenter_hostname: "Template:Vcenter hostname" username: "Template:Vcenter user" password: "Template:Vcenter pass" guest: "Template:Inventory hostname" state: present vm_extra_config: notes: "Template:Notes" vm_disk: disk1: size_gb: "Template:Disk" type: thin datastore: "Template:Datastore" vm_nic: nic1: type: vmxnet3 network: "Template:Network" network_type: standard vm_hardware: memory_mb: "Template:Memory" num_cpus: "Template:Cpucount" osid: "Template:Osid" scsi: paravirtual esxi: datacenter: "Template:Datacenter" hostname: "Template:Esxi host" - name: Gather VM facts vsphere_guest: vcenter_hostname: "Template:Vcenter hostname" username: "Template:Vcenter user" password: "Template:Vcenter pass" guest: "Template:Inventory hostname" validate_certs: False vmware_guest_facts: yes register: newvm tags: mac
- name: create forward lookup entry DNS" nsupdate: key_name: "testlab.lan" key_secret: "U93nnwyHGYr20Ro6YNTDng==" server: "172.16.0.1" zone: "testlab.lan." record: "Template:Inventory hostname" value: "Template:Ip"
- name: create reverse lookup entry DNS" nsupdate: key_name: "testlab.lan" key_secret: "U93nnwyHGYr20Ro6YNTDng==" server: "172.16.0.1" zone: "16.172.in-addr.arpa" type: PTR record: "Template:Rip" value: "Template:Inventory hostname.testlab.lan."
- name: Prepare for PXE install file: > path=/tftpboot/pxelinux.cfg/01-Template:Newvm.ansible facts.hw eth0.macaddress dash src=/tftpboot/pxelinux.cfg/centos70 state=hard sudo: yes tags: mac
- name: Power on VMs vsphere_guest: vcenter_hostname: "Template:Vcenter hostname" username: "Template:Vcenter user" password: "Template:Vcenter pass" guest: "Template:Inventory hostname" validate_certs: False state: powered_on force: yes
- pause: seconds: 15
- name: Remove kickstart link file: > path=/tftpboot/pxelinux.cfg/01-Template:Newvm.ansible facts.hw eth0.macaddress dash src=/tftpboot/pxelinux.cfg/centos70 state=absent sudo: yes tags: mac