Using Ansible GKE modules for modifying gke cluster parameters

Viewed 202

We are using the below Ansible modules to build our GKE clusters.

      google.cloud.gcp_container_cluster
      google.cloud.gcp_container_node_pool   

https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp_container_node_pool_module.html

https://docs.ansible.com/ansible/latest/collections/google/cloud/gcp_container_cluster_module.html

The following is the code snippet

   - name: create a cluster
     google.cloud.gcp_container_cluster:
         name: cluster-nodepool
         initial_node_count: 4
         location: us-central1-a
         project: "{{ gcp_project }}"
         auth_kind: "{{ gcp_cred_kind }}"
         service_account_file: "{{ gcp_cred_file }}"
         state: present
         register: cluster

      - name: create a node pool
        google.cloud.gcp_container_node_pool:
            name: my-pool
            initial_node_count: 4
            cluster: "{{ cluster }}"
            location: us-central1-a
            project: test_project
            auth_kind: serviceaccount
            service_account_file: "/tmp/auth.pem"
            state: present

Cluster creation and deletion is working fine for us, but we are struggling with modification of existing gke parameters. For example use cases like

   1) Changing the initial no of Nodes in Cluster
          initial_node_count: 6
   2) Adding more network tags 
   3) Add more entries to authorized networks  etc

Such use cases of modifying existing gke parameters is not taking place using ansible. We have to make changes these changes using the GKE console only.

Can we modify parameters of any GCP resource created using Ansible or Ansible is for one time infrastructure creation only and subsequent changes has to be from GCP console.

Or is it something like the Ansible GKE modules we are using does not support modifying/adding parameters for existing GKE Clusters

0 Answers
Related