Hi All,
I need some suggestions, I have an Ansible project that I use to deploy
Kubernetes with KOPS. The inventory file is very simple
[targets]
localhost ansible_connection=local
I also use this project to add additional functionality to my clusters with
for instance the dashboard docker file. Basically it looks like:
- name: Add Kubernetes dashboard deployment configuration
template:
src: kubernetes-dashboard.yaml.j2
dest: /tmp/kubernetes-dashboard.yaml
mode: 0644
become: false
- name: Launch Kubernetes dashboard service
command: "kubectl create -f /tmp/kubernetes-dashboard.yaml"
However I was thinking it would be better if I could pass a context into
the kubectl command like cluster foo.east.example.com or
foo.west.example.com. This is all supported already in kubectl like this:
- name: Launch Kubernetes dashboard service
command: "kubectl --context=foo.east.example.com create -f
/tmp/kubernetes-dashboard.yaml"
What I'm not sure about is how I can setup my inventory file to perhaps
have variables such as the cluster name. For instance could I do something
like
[foo.east.example.com]
localhost ansible_connection=local
[foo.west.example.com]
localhost ansible_connection=local
And then setup a group/foo.east.example.com.yaml file and put my variables
in there for that cluster and do the same for a
group/foo.west.example.com/yaml file ?
Is that a best practices way to do it?
Thanks for any insight you can provide!
Matt
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/f576284e-c1dd-47e4-aa47-9a4f53d99430%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.