1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Added the ability to set the size of the boot volume. (#19703)

* Added the ability to set the size of the boot volume.

* Made disk_size parameter of type int with 10 default.
This commit is contained in:
rmarsa 2017-01-11 15:08:31 -06:00 committed by Ryan Brown
parent cd3fdca540
commit 1d80a8dbfb

View file

@ -171,6 +171,12 @@ options:
(requires libcloud >= 0.20.0)
required: false
default: "false"
disk_size:
description:
- The size of the boot disk created for this instance (in GB)
required: false
default: 10
version_added: "2.3"
requirements:
- "python >= 2.6"
@ -197,6 +203,7 @@ EXAMPLES = '''
service_account_email: "your-sa@your-project-name.iam.gserviceaccount.com"
credentials_file: "/path/to/your-key.json"
project_id: "your-project-name"
disk_size: 32
# Create a single Debian 8 instance in the us-central1-a Zone
# Use existing disks, custom network/subnetwork, set service account permissions
@ -384,6 +391,7 @@ def create_instances(module, gce, instance_names, number):
external_ip = module.params.get('external_ip')
disk_auto_delete = module.params.get('disk_auto_delete')
preemptible = module.params.get('preemptible')
disk_size = module.params.get('disk_size')
service_account_permissions = module.params.get('service_account_permissions')
service_account_email = module.params.get('service_account_email')
@ -505,7 +513,7 @@ def create_instances(module, gce, instance_names, number):
try:
pd = gce.ex_get_volume("%s" % instance, lc_zone)
except ResourceNotFoundError:
pd = gce.create_volume(None, "%s" % instance, image=lc_image())
pd = gce.create_volume(disk_size, "%s" % instance, image=lc_image())
gce_args['ex_boot_disk'] = pd
inst = None
@ -635,6 +643,7 @@ def main():
ip_forward = dict(type='bool', default=False),
external_ip=dict(default='ephemeral'),
disk_auto_delete = dict(type='bool', default=True),
disk_size = dict(type='int', default=10),
preemptible = dict(type='bool', default=None),
),
mutually_exclusive=[('instance_names', 'name')]