我想用带有100 GB磁盘的ansible gce模块创建google计算实例。但是gce模块中没有用于在gce模块中设置实例的磁盘大小的配置。
我知道我们可以通过使用gce_pd模块创建磁盘然后附加到新实例来解决这个问题,但有没有正确的方法呢?
支持它非常简单,因为lib cloud lib已经支持这个参数。
答案 0 :(得分:0)
It doesn't seem to be possible directly, but the gce
module uses the first item in disks
as the boot image (see code).
So you can create a customized boot disk as follows:
- name: Create custom boot disk
gce_pd:
name: "{{ instance_name }}"
image: "{{ instance_image }}"
size_gb: "{{ disk_size }}"
zone: "{{ zone }"
- name: Launch instance with custom boot disk
gce:
name: "{{ instance_name }}"
image: "{{ instance_image }}"
zone: "{{ zone }}"
disks:
- name: "{{ instance_name }}"
mode: READ_WRITE