How to Add external IP to an existing GCP VM

**I want to add an external IP to the existing VM in GCP **.

  • I have a GCP VM with epharmal IP I want to attach a reserved external IP to the instance
  • I am using google.cloud collection
  • when I run a playbook with the desired IP playbook just ignores it.
    - name: get info on an address
      gcp_compute_address_info:
        region: us-east4
        filters:
        - name = ip-name
        project: gcp-project
        auth_kind: serviceaccount
        service_account_file: "/root/creds.json"
      register: address
    - name: update instance
      gcp_compute_instance:
        auth_kind: serviceaccount
        service_account_file: "{{ auth_file_name_path }}"
        project: lab-wifi-staging
        zone: us-east4-a
        name: "{{ server_name }}"
        network_interfaces:
        - subnetwork: {selfLink: "projects/lab-wifi-staging/regions/{{region}}/subnetworks/{{subnet}}"}
          access_configs:
          - name: 'External NAT'
            nat_ip: "{{ address }}"
            type: 'ONE_TO_ONE_NAT'
  • Set at least one tag (the experts follow the tags, so the right people will find you if you tag)