ManageIQ / manageiq

ManageIQ Open-Source Management Platform
https://manageiq.org
Apache License 2.0
1.34k stars 900 forks source link

unable to provision a VM on GCP through ansible-playbook #23066

Open 0saurabh0 opened 3 weeks ago

0saurabh0 commented 3 weeks ago
  1. Describe the issue you are having and what you expected to happen. Unable to provision/create a VM on GCP through ansible-playbook, throws an error python 3.8 or later is required

Fryguy commented 2 weeks ago

@0saurabh0 I see it says Docker so I wanted to confirm, are you using the monolithic docker image or the operator based deployment?

Also, would it be possible to share the ansible playbook you are using, or perhaps a reproducer?

0saurabh0 commented 2 weeks ago

@Fryguy I basically pulled the latest docker image as mentioned here. also the playbook sort of looks like :

- name: Provision a GCP VM
  hosts: localhost
  gather_facts: false

  vars:
    gcp_project: velero-demo-418320 
    machine_type: "e2-medium"
    gcp_cred_kind: serviceaccount
    instance_name: "my-vm-instance"
    zone: "us-central1-a"
    region: "us-central1"
    machine_type: "e2-medium"
    image: "https://www.googleapis.com/compute/v1/projects/rocky-linux-cloud/global/images/rocky-linux-8-optimized-gcp-v20230411" 

  tasks:
    - name: Create an external address associated with the instance
      gcp_compute_address:
        name: "{{ zone }}-ip"
        region: "{{ region }}"
        project: "{{ gcp_project }}"
        service_account_file: "{{ gcp_cred_file }}"
        auth_kind: "{{ gcp_cred_kind }}"
      register: gce_ip

    - name: Create the GCP VM
      gcp_compute_instance:
        name: "{{ instance_name }}"
        machine_type: "{{ machine_type }}"
        zone: "{{ zone }}"
        project: "{{ gcp_project }}"
        service_account_file: "{{ gcp_cred_file }}"
        auth_kind: "{{ gcp_cred_kind }}"
        disks:
          - auto_delete: true
            boot: true
            initialize_params:
              source_image: "{{ image }}"
        network_interfaces:
          - access_configs: # if you don't add this then the VM instance will have no external address attached to it
              - name: External NAT
                nat_ip: "{{ gce_ip }}"
                type: ONE_TO_ONE_NAT
      register: result

    - name: Print the VM's IP address
      debug:
        var: gce_ip.address

and I am passing all the credentials through the key-value pair which is available while creating the catalog.