Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't power down a virtual machine. #624

Open
HichamMourad opened this issue Apr 2, 2024 · 0 comments
Open

Can't power down a virtual machine. #624

HichamMourad opened this issue Apr 2, 2024 · 0 comments

Comments

@HichamMourad
Copy link

SUMMARY

Using the following in a playbook to shut down a vm. It returns an error that is related to gcloud command line.

- name: Stop the desired GCP VM instance
  google.cloud.gcp_compute_instance:
    project: "{{ gcp_project }}"
    zone: "{{ gcp_zone }}"
    auth_kind: serviceaccount
    status: "TERMINATED"
    deletion_protection: false
  when: gcp_instance_info.resources[0].name == "{{ vm_name }}"

The ERROR:
"msg": "GCP returned error: {'error': {'code': 400, 'message': 'VM has a Local SSD attached but an undefined value for discard-local-ssd. If using gcloud, please add --discard-local-ssd=false or --discard-local-ssd=true to your command.', 'errors': [{'message': 'VM has a Local SSD attached but an undefined value for discard-local-ssd. If using gcloud, please add --discard-local-ssd=false or --discard-local-ssd=true to your command.', 'domain': 'global', 'reason': 'badRequest'}]}}",

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Google Cloud certified collection for Ansible Automation Platform.

ANSIBLE VERSION
Ansible Automation Platform 2.4 latest.
COLLECTION VERSION
1.3.0
CONFIGURATION

OS / ENVIRONMENT

RHEL 9

STEPS TO REPRODUCE

Trigger the above code in an ansible playbook.

---
- name: Shutdown a GCP vm instance by name
  hosts: localhost
  connection: local
  gather_facts: false

  tasks:
    - name: Retrieve info for the GCP VM instances
      google.cloud.gcp_compute_instance_info:
        project: "{{ gcp_project }}"
        zone: "{{ gcp_zone }}"
        auth_kind: serviceaccount
      register: gcp_instance_info

    - name: Stop the desired GCP VM instance
      google.cloud.gcp_compute_instance:
        project: "{{ gcp_project }}"
        zone: "{{ gcp_zone }}"
        auth_kind: serviceaccount
        status: "TERMINATED"
        deletion_protection: false
      when: gcp_instance_info.resources[0].name == "{{ vm_name }}"
EXPECTED RESULTS

power off the virtual machine

ACTUAL RESULTS

ERROR MESSAGE
"msg": "GCP returned error: {'error': {'code': 400, 'message': 'VM has a Local SSD attached but an undefined value for discard-local-ssd. If using gcloud, please add --discard-local-ssd=false or --discard-local-ssd=true to your command.', 'errors': [{'message': 'VM has a Local SSD attached but an undefined value for discard-local-ssd. If using gcloud, please add --discard-local-ssd=false or --discard-local-ssd=true to your command.', 'domain': 'global', 'reason': 'badRequest'}]}}",


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant