Provision VM using virtual network.
This commit is contained in:
parent
935acf9efb
commit
8ef95374e7
1 changed files with 10 additions and 1 deletions
11
cloud/azure
11
cloud/azure
|
@ -77,6 +77,11 @@ options:
|
||||||
- if this option is specified, password-based ssh authentication will be disabled.
|
- if this option is specified, password-based ssh authentication will be disabled.
|
||||||
required: false
|
required: false
|
||||||
default: null
|
default: null
|
||||||
|
virtual_network_name:
|
||||||
|
description:
|
||||||
|
- Name of virtual network.
|
||||||
|
required: false
|
||||||
|
default: null
|
||||||
hostname:
|
hostname:
|
||||||
description:
|
description:
|
||||||
- hostname to write /etc/hostname. Defaults to <name>.cloudapp.net.
|
- hostname to write /etc/hostname. Defaults to <name>.cloudapp.net.
|
||||||
|
@ -233,6 +238,7 @@ def create_virtual_machine(module, azure):
|
||||||
role_size = module.params.get('role_size')
|
role_size = module.params.get('role_size')
|
||||||
storage_account = module.params.get('storage_account')
|
storage_account = module.params.get('storage_account')
|
||||||
image = module.params.get('image')
|
image = module.params.get('image')
|
||||||
|
virtual_network_name = module.params.get('virtual_network_name')
|
||||||
wait = module.params.get('wait')
|
wait = module.params.get('wait')
|
||||||
wait_timeout = int(module.params.get('wait_timeout'))
|
wait_timeout = int(module.params.get('wait_timeout'))
|
||||||
|
|
||||||
|
@ -295,7 +301,9 @@ def create_virtual_machine(module, azure):
|
||||||
system_config=linux_config,
|
system_config=linux_config,
|
||||||
network_config=network_config,
|
network_config=network_config,
|
||||||
os_virtual_hard_disk=os_hd,
|
os_virtual_hard_disk=os_hd,
|
||||||
role_size=role_size)
|
role_size=role_size,
|
||||||
|
role_type='PersistentVMRole',
|
||||||
|
virtual_network_name=virtual_network_name)
|
||||||
_wait_for_completion(azure, result, wait_timeout, "create_virtual_machine_deployment")
|
_wait_for_completion(azure, result, wait_timeout, "create_virtual_machine_deployment")
|
||||||
except WindowsAzureError as e:
|
except WindowsAzureError as e:
|
||||||
module.fail_json(msg="failed to create the new virtual machine, error was: %s" % str(e))
|
module.fail_json(msg="failed to create the new virtual machine, error was: %s" % str(e))
|
||||||
|
@ -391,6 +399,7 @@ def main():
|
||||||
user=dict(),
|
user=dict(),
|
||||||
password=dict(),
|
password=dict(),
|
||||||
image=dict(),
|
image=dict(),
|
||||||
|
virtual_network_name=dict(default=None),
|
||||||
state=dict(default='present'),
|
state=dict(default='present'),
|
||||||
wait=dict(type='bool', default=False),
|
wait=dict(type='bool', default=False),
|
||||||
wait_timeout=dict(default=600),
|
wait_timeout=dict(default=600),
|
||||||
|
|
Loading…
Reference in a new issue