Good afternoon. Hope all is well.  This is my first post here though I've 
been lurking for several months. Apologies in advance if this is the 
incorrect forum. 

I am trying to target multiple k8s/OpenShift clusters with a playbook.  
Using the examples, I can successfully target a single remote cluster:

- hosts: localhost
  module_defaults:
    group/k8s:
      host: https://api.cluster001.digitalhermit.com:6443
      ca_cert: /path/to/cluster001.digitalhermit.com.crt
      validate_certs: no
  tasks:
  - block:
    - name: Log in (obtain access token)
      k8s_auth:
        username: "{{ k8s_admin_username }}"
        password: "{{ k8s_admin_password }}"
      register: k8s_auth_results
    - name: Do something

This snippet works for the most part (though I am getting python TLS 
warnings).

What I'm trying to do is target multiple OCP clusters. 

I can use a variable for the host name:
  module_defaults:
    group/k8s:
      host: "{{ k8s_cluster_name }}"
      ca_cert: /path/to/cluster001.digitalhermit.com.crt

And call with:  

ansible-playbook foo.yaml -e ā€œk8s_cluster_name=
https://api.cluster001.foo.com:6443ā€

This works. However, I’m looking for a way to pass a list of clusters and 
run the playbook in parallel across them.

I tried with an inventory file, but this seems to only specify where the 
playbooks run, not the target clusters.

Is there an example somewhere that shows how to target multiple separate 
clusters?


Thanks,

KL

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a7fa282d-6545-4931-aa30-978042ea1032n%40googlegroups.com.

Reply via email to