Build React Native App (4) - Redux, Jest, and NativeBase

From this tutorial, I will demonstrate how to create empty VM using vsphere_client module. This is really simple example and most configuration file came from Ansible document
As specified from the above reference, we need to install pysphere module from python.
[ansible@ansible01 ~]$ sudo pip install pysphere
Collecting pysphere
Downloading pysphere-0.1.7.zip (516kB)
100% |████████████████████████████████| 522kB 977kB/s
Installing collected packages: pysphere
Running setup.py install for pysphere ... done
Successfully installed pysphere-0.1.7
[ansible@ansible01 ~]$
From the above reference, we will need to prepare following parameteres from VCenter.
---
- name: Create VM
hosts: localhost
connection: local
tasks:
- name: createVM
vsphere_guest:
vcenter_hostname: 10.200.0.11
validate_certs: no
username: vsphere_login
password: vsphere_password
guest: centostest01
state: powered_off
vm_extra_config:
vcpu.hotadd: yes
mem.hotadd: yes
notes: This is a test VM for centos
folder: Docker
vm_disk:
disk1:
size_gb: 20
type: thin
datastore: PRD-NFS-01
vm_nic:
nic1:
type: vmxnet3
network: VM Network
network_type: standard
vm_hardware:
memory_mb: 2048
num_cpus: 2
osid: centos64Guest
scsi: paravirtual
esxi:
datacenter: FlairTest
hostname: 10.200.0.51
We didn't specify the hosts for this testing. Ignore the warning message.
[ansible@ansible01 test]$ ansible-playbook createvmtest.yml
[WARNING]: Unable to parse /etc/ansible/hosts as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the
implicit localhost does not match 'all'
PLAY [Create VM] **************************************************************************
TASK [Gathering Facts] ********************************************************************
ok: [localhost]
TASK [createVM] ***************************************************************************
changed: [localhost]
PLAY RECAP ********************************************************************************
localhost : ok=2 changed=1 unreachable=0 failed=0
[ansible@ansible01 test]$
From this example, we created new vm using Ansible successfully. One of issue on this is that an OS is not installed yet. From next tutorial, we will create new VM by copying new VM from existing template.
Comments
Post a Comment