Hi Folks,

I'm using ansible 2.8.4 with Google cloud platform. I'm using *Inventory 
Plugins* to get the dynamic inventory as ansible recommends. 
I've 2 Apache nifi clusters, so I'm pulling inventory using *gcp_compute*. 
Each cluster I have a label
index: 1 and index: 2 so that I can pull vms dynamically based on the 
index. 


plugin inventory:

*plugin: gcp_compute*
*projects:*
*  - my-gcp-project*
*auth_kind: serviceaccount*
*keyed_groups:*
*  - prefix: gcp*
*    key: labels*
*compose:*
*  ansible_host: networkInterfaces[0].networkIP*

then I get dynamic groups gcp_index_1 and gcp_index_2 which I am using in 
my playbooks. Currently I have 2 playbooks one for the cluster 1 and 
another for cluster 2. 
In the playbooks I've hardcoded those groups like gcp_index_1 and 
gcp_index_2 which essential does the same things but deploys on different 
clusters.

With AWS/Azure, I used Inventory scripts, where I had my groups specified 
in the hosts file and then used to pull the inventory based on the multiple 
tags.
e.g AZURE_TAGS=stack:dev,index:1 ansible-playbook nifi-install.yml. 
In GCP, I would like to do the same but is there a way to pull inventory 
with multiple labels so that i can avoid duplication of having separate 
playbooks for each cluster.
i.e. I'd like to have one playbook and target which cluster I want to 
install nifi based on multiple labels. 

any suggestions how I go about acheiveing this?

Regards,
Sreenivas

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/389e5b23-3c8d-4f94-b895-f4c750c6b095%40googlegroups.com.

Reply via email to