使用Ansible停止Google计算资源

问题描述 投票:1回答:1

您可以使用Ansible创建新的GCP实例,但是如何终止该实例呢?

我没有看到执行此操作的命令。

google-cloud-platform ansible
1个回答
2
投票

好,看来您所要做的只是将资源的状态设置为“不存在”

所以它看起来像:

- name: detroy instance
  gcp_compute_instance:
     state: absent
     name: "{{servername}}"
     zone: "{{ zone }}"
     project: "{{ gcp_project }}"
     auth_kind: "{{ gcp_cred_kind }}"
     service_account_file: "{{ gcp_cred_file }}"
© www.soinside.com 2019 - 2024. All rights reserved.