Fix missing ansible_facts.
This commit is contained in:
parent
ca4365b644
commit
de15a631ad
1 changed files with 5 additions and 8 deletions
|
@ -756,7 +756,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
||||||
|
|
||||||
self.log("Create virtual machine with parameters:")
|
self.log("Create virtual machine with parameters:")
|
||||||
self.log(self.serialize_obj(vm_resource, 'VirtualMachine'), pretty_print=True)
|
self.log(self.serialize_obj(vm_resource, 'VirtualMachine'), pretty_print=True)
|
||||||
self.results['state'] = self.create_or_update_vm(vm_resource)
|
self.create_or_update_vm(vm_resource)
|
||||||
|
|
||||||
elif self.differences and len(self.differences) > 0:
|
elif self.differences and len(self.differences) > 0:
|
||||||
# Update the VM based on detected config differences
|
# Update the VM based on detected config differences
|
||||||
|
@ -826,31 +826,29 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
||||||
)
|
)
|
||||||
self.log("Update virtual machine with parameters:")
|
self.log("Update virtual machine with parameters:")
|
||||||
self.log(self.serialize_obj(vm_resource, 'VirtualMachine'), pretty_print=True)
|
self.log(self.serialize_obj(vm_resource, 'VirtualMachine'), pretty_print=True)
|
||||||
self.results['state'] = self.create_or_update_vm(vm_resource)
|
self.create_or_update_vm(vm_resource)
|
||||||
|
|
||||||
# Make sure we leave the machine in requested power state
|
# Make sure we leave the machine in requested power state
|
||||||
if powerstate_change == 'poweron' and self.results['state']['powerstate'] != 'running':
|
if powerstate_change == 'poweron' and self.results['state']['powerstate'] != 'running':
|
||||||
# Attempt to power on the machine
|
# Attempt to power on the machine
|
||||||
self.power_on_vm()
|
self.power_on_vm()
|
||||||
self.results['state'] = self.serialize_vm(self.get_vm())
|
|
||||||
|
|
||||||
elif powerstate_change == 'poweroff' and self.results['state']['powerstate'] == 'running':
|
elif powerstate_change == 'poweroff' and self.results['state']['powerstate'] == 'running':
|
||||||
# Attempt to power off the machine
|
# Attempt to power off the machine
|
||||||
self.power_off_vm()
|
self.power_off_vm()
|
||||||
self.results['state'] = self.serialize_vm(self.get_vm())
|
|
||||||
|
|
||||||
elif powerstate_change == 'restarted':
|
elif powerstate_change == 'restarted':
|
||||||
self.restart_vm()
|
self.restart_vm()
|
||||||
self.results['state'] = self.serialize_vm(self.get_vm())
|
|
||||||
|
|
||||||
elif powerstate_change == 'deallocated':
|
elif powerstate_change == 'deallocated':
|
||||||
self.deallocate_vm()
|
self.deallocate_vm()
|
||||||
self.results['state'] = self.serialize_vm(self.get_vm())
|
|
||||||
|
self.results['ansible_facts']['azure_rm_vm'] = self.serialize_vm(self.get_vm())
|
||||||
|
|
||||||
elif self.state == 'absent':
|
elif self.state == 'absent':
|
||||||
# delete the VM
|
# delete the VM
|
||||||
self.log("Delete virtual machine {0}".format(self.name))
|
self.log("Delete virtual machine {0}".format(self.name))
|
||||||
self.results['state']['status'] = 'Deleted'
|
self.results['ansible_facts']['azure_rm_vm'] = None
|
||||||
self.delete_vm(vm)
|
self.delete_vm(vm)
|
||||||
|
|
||||||
# until we sort out how we want to do this globally
|
# until we sort out how we want to do this globally
|
||||||
|
@ -1093,7 +1091,6 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
||||||
self.get_poller_result(poller)
|
self.get_poller_result(poller)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
self.fail("Error creating or updating virtual machine {0} - {1}".format(self.name, str(exc)))
|
self.fail("Error creating or updating virtual machine {0} - {1}".format(self.name, str(exc)))
|
||||||
return self.serialize_vm(self.get_vm())
|
|
||||||
|
|
||||||
def vm_size_is_valid(self):
|
def vm_size_is_valid(self):
|
||||||
'''
|
'''
|
||||||
|
|
Loading…
Reference in a new issue