Ansible with k8s-module example

435 views
Skip to first unread message

Kylix3511

unread,
Feb 6, 2019, 4:04:56 PM2/6/19
to Ansible Project
Hi All, 

Ansible k8s module (  https://docs.ansible.com/ansible/latest/modules/k8s_module.html#k8s-module ) have many environments like : 

api_key ---- K8S_AUTH_API_KEY environment variable.
cert_file --- K8S_AUTH_CERT_FILE environment variable.
context --- K8S_AUTH_CONTEXT environment variable.
host --- K8S_AUTH_HOST environment variable.
key_file --- K8S_AUTH_HOST environment variable.
kubeconfig --- K8S_AUTH_KUBECONFIG environment variable.
password --- K8S_AUTH_PASSWORD environment variable.
ssl_ca_cert --- K8S_AUTH_SSL_CA_CERT environment variable.
username ---- K8S_AUTH_USERNAME environment variable.
verify_ssl ----  K8S_AUTH_VERIFY_SSL environment variable.


Do any body use these environmental variables in the playbook ? Do have any example or sample playbook with one or many environment variable. I'm looking very specially for kubeconfig --- K8S_AUTH_KUBECONFIG environment variable to use it in ansible playbooks ( and also in Ansible AWX ) 

Please help.  

will

unread,
Feb 6, 2019, 7:05:45 PM2/6/19
to i Kylix, 'Rajas Pachipulusu' via Ansible Project, fabianvf, chouseknecht
Yes, I've used K8S_AUTH_KUBECONFIG and K8S_AUTH_CONTEXT

K8S_AUTH_KUBECONFIG=~/.kube/another_kube_config ansible-playbook kubernetes.yml
K8S_AUTH_CONTEXT=minikube ansible-playbook do_something_with_minikube.yml

There was an issue with early 2.7 Ansible that you needed to set both variables but that was fixed with https://github.com/ansible/ansible/pull/47496 which seems to be in 2.7.1 according to git tag --contains

Will


---- On Thu, 07 Feb 2019 07:37:58 +1000 i Kylix <kyli...@gmail.com> wrote ----
> + module authors for some sights and help :)
>
>
> On Feb 6, 2019, at 1:04 PM, Kylix3511 <kyli...@gmail.com> wrote:
> Hi All,
> Ansible k8s module ( https://docs.ansible.com/ansible/latest/modules/k8s_module.html#k8s-module ) have many environments like :
> api_key ---- K8S_AUTH_API_KEY environment variable.cert_file --- K8S_AUTH_CERT_FILE environment variable.context --- K8S_AUTH_CONTEXT environment variable.host --- K8S_AUTH_HOST environment variable.key_file --- K8S_AUTH_HOST environment variable.kubeconfig --- K8S_AUTH_KUBECONFIG environment variable.password --- K8S_AUTH_PASSWORD environment variable.ssl_ca_cert --- K8S_AUTH_SSL_CA_CERT environment variable.username ---- K8S_AUTH_USERNAME environment variable.verify_ssl ---- K8S_AUTH_VERIFY_SSL environment variable.
>
> Do any body use these environmental variables in the playbook ? Do have any example or sample playbook with one or many environment variable. I'm looking very specially for kubeconfig --- K8S_AUTH_KUBECONFIG environment variable to use it in ansible playbooks ( and also in Ansible AWX )
> Please help.
> --
> 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-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/e217a422-74bd-42c9-b169-d9036cf8c4dd%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
>


i Kylix

unread,
Feb 6, 2019, 8:04:57 PM2/6/19
to will, i Kylix, 'Rajas Pachipulusu' via Ansible Project
Thanks Will. Appreciate your help on this. 



Thanks. 

Regards,
kylix3511 


Sent from  iPhone 

i Kylix

unread,
Feb 8, 2019, 12:35:23 PM2/8/19
to 'Rajas Pachipulusu' via Ansible Project, fabi...@redhat.com, chouse...@redhat.com, wi...@thames.id.au, i Kylix
+ module authors for some sights and help :) 

On Feb 6, 2019, at 1:04 PM, Kylix3511 <kyli...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages