kubectl get nodes using context from a playbook

43 views
Skip to first unread message

user user

unread,
Aug 29, 2019, 6:17:20 AM8/29/19
to Ansible Project
I'm trying to fetch nodes list via ansible playbook using a context name. but its not working

my playbook:

cat getnodes.yaml
---
   - name: "get nodes"
     hosts: kubernetes
     tasks:
         - name: "nodes"
            command: "kubectl --context='contextname' get nodes"

I do have multiple clusters in the config file.. so I need to use context.

user user

unread,
Sep 5, 2019, 3:52:32 PM9/5/19
to Ansible Project
Any help on this. 

I do have multiple clusters in config file. I need to either specify cluster name or context name and get the nodes list or to perform any activity  on a particular cluster
Reply all
Reply to author
Forward
0 new messages