Skip to content

Instantly share code, notes, and snippets.

@mikecali
Created December 14, 2016 01:58
Show Gist options
  • Save mikecali/83d4fc1a5e34c9ea35b86eb225f7f905 to your computer and use it in GitHub Desktop.
Save mikecali/83d4fc1a5e34c9ea35b86eb225f7f905 to your computer and use it in GitHub Desktop.
Playbook result with error and another file included is the playbook itself.
[mikecali@rhel-tower vm_disk_add]$ ansible-playbook tasks/add_disks.yml -vvvv
Using /etc/ansible/ansible.cfg as config file
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc
PLAYBOOK: add_disks.yml ********************************************************
1 plays in tasks/add_disks.yml
PLAY [Reconfigure VM Filesystem] ***********************************************
TASK [Reconfigure Reconfigure VM Filesystem] ***********************************
task path: /home/mikecali/mike-personal/vm_disk_add/tasks/add_disks.yml:26
Using module file /usr/lib/python2.7/site-packages/ansible/modules/core/cloud/vmware/vsphere_guest.py
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: mikecali
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1481678610.17-273194120531311 `" && echo ansible-tmp-1481678610.17-273194120531311="` echo $HOME/.ansible/tmp/ansible-tmp-1481678610.17-273194120531311 `" ) && sleep 0'
<127.0.0.1> PUT /tmp/tmpE14O0U TO /home/mikecali/.ansible/tmp/ansible-tmp-1481678610.17-273194120531311/vsphere_guest.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /home/mikecali/.ansible/tmp/ansible-tmp-1481678610.17-273194120531311/ /home/mikecali/.ansible/tmp/ansible-tmp-1481678610.17-273194120531311/vsphere_guest.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/usr/bin/python /home/mikecali/.ansible/tmp/ansible-tmp-1481678610.17-273194120531311/vsphere_guest.py; rm -rf "/home/mikecali/.ansible/tmp/ansible-tmp-1481678610.17-273194120531311/" > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {
"changed": false,
"failed": true,
"invocation": {
"module_args": {
"cluster": null,
"esxi": {
"datacenter": "ALABS-Wellington",
"hostname": "172.17.203.4"
},
"force": true,
"from_template": null,
"guest": "RHEL-jmt",
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"power_on_after_clone": true,
"resource_pool": null,
"snapshot_to_clone": null,
"state": "reconfigured",
"template_src": null,
"username": "administrator@vsphere.local",
"validate_certs": false,
"vcenter_hostname": "172.17.203.6",
"vm_disk": {
"disk1": {
"datastore": "VM-Datastore-1",
"size_gb": 31,
"type": "thin"
},
"disk2": {
"datastore": "VM-Datastore-1",
"size_gb": 10,
"type": "thin"
}
},
"vm_extra_config": {
"mem.hotadd": true,
"vcpu.hotadd": true
},
"vm_hardware": {
"memory_mb": "1024",
"num_cpus": "1",
"osid": "RH7",
"scsi": "paravirtual"
},
"vm_hw_version": null,
"vm_nic": {
"nic1": {
"network": "VM Network",
"network_type": "standard",
"type": "vmxnet3"
}
},
"vmware_guest_facts": null
},
"module_name": "vsphere_guest"
},
"msg": "Error reconfiguring vm: Invalid configuration for device '0'., [{'size_gb': 10, 'type': 'thin', 'datastore': 'VM-Datastore-1'}]"
}
---
- name: Reconfigure VM Filesystem
hosts: localhost
connection: local
gather_facts: False
vars:
ip_addr: "172.17.203.24"
netmask: "255.255.255.192"
gateway: "172.17.203.1"
net_interface: eth0
vcenter_username: "administrator@vsphere.local"
vcenter_password: "xxxx"
alabs_cluster: "NextGen-Cluster"
alabs_dc: "ALABS-Wellington"
alabs_dns: "172.17.171.173"
alabs_domain: "alabs.datacom.co.nz"
datastore: "VM-Datastore-1"
folder: Template
vm_name: RHEL-jmt
tasks:
- name: Reconfigure Reconfigure VM Filesystem
vsphere_guest:
validate_certs: False
vcenter_hostname: 172.17.203.6
username: "administrator@vsphere.local"
password: "xxxx"
guest: "{{ vm_name }}"
force: yes
state: reconfigured
vm_extra_config:
vcpu.hotadd: yes
mem.hotadd: yes
vm_nic:
nic1:
type: vmxnet3
network: VM Network
network_type: standard
vm_hardware:
memory_mb: "1024"
num_cpus: "1"
osid: RH7
scsi: paravirtual
vm_disk:
disk1:
size_gb: 31
type: thin
datastore: VM-Datastore-1
disk2:
size_gb: 10
type: thin
datastore: VM-Datastore-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment