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 collection
  • when I run a playbook with the desired IP playbook just ignores it.
    - name: get info on an address
        region: us-east4
        - name = ip-name
        project: gcp-project
        auth_kind: serviceaccount
        service_account_file: "/root/creds.json"
      register: address
    - name: update instance
        auth_kind: serviceaccount
        service_account_file: "{{ auth_file_name_path }}"
        project: lab-wifi-staging
        zone: us-east4-a
        name: "{{ server_name }}"
        - subnetwork: {selfLink: "projects/lab-wifi-staging/regions/{{region}}/subnetworks/{{subnet}}"}
          - 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)