【发布时间】:2019-02-25 22:31:02
【问题描述】:
我正在使用 Ansible 在 Google Cloud 中创建实例,但是当我想将现有磁盘附加到新的计算引擎时,我无法附加它或将其添加到实例。
- name: Launch instances
gce:
instance_names: mongo
machine_type: "n1-standard-1"
image: "debian-9"
service_account_email: "xxxx@xxxx.iam.gserviceaccount.com"
credentials_file: "gcp-credentials.json"
project_id: "learning"
disk_size: 10
disk_auto_delete: false
preemptible: true
tags: "mongo-server"
register: gce
- name: Wait for SSH for instances
wait_for:
delay: 1
host: "{{ item.public_ip }}"
port: 22
state: started
timeout: 30
with_items: "{{ gce.instance_data }}"
我的错误是:
错误是:libcloud.common.google.ResourceExistsError: {'domain': 'global', 'message': "The resource 'projects/xxx-xxx/zones/us-central1-a/disks/mongo'已经存在", '原因': 'alreadyExists'}
有任何形式可以用 Ansible 配置这个选项吗?为此,我现在使用外部脚本。
【问题讨论】: