On 19. april 2017 20:46, Matt Snoby wrote:
Hello,
I'm looking for advice on how to improve my implementation of my playbook.
 I know the way I have designed it is very different from the normal way of
doing playbooks.  I have a playbook that controls deploying configuration
to 4 different kubernetes clusters.  I use kubectl in a command shell to
execute the commands to do deployments. Here is my inventory file:

# Inventory File
#
[east.k.tropo.com]
localhost              ansible_connection=local


[east2.k.tropo.com]
localhost              ansible_connection=local


[k8s.int.ops.tropo.com]
localhost              ansible_connection=local


[k8s.k.dub.tropo.com]
localhost              ansible_connection=local


#[test.c.tropo.com]
#localhost              ansible_connection=local





I have each cluster setup in it's own group, each group has it's variables
in it's own file under inventory/group_vars/ so that when I want to deploy
an job to that cluster I would do something like this:

ansible-playbook create.yaml -l k8s.k.dub.tropo.com  --tags foo



My problem is ( I think ) that because each group just has localhost in it,
than localhost gets all the variables from the other groups.  This really
does break things.  Is there some sort of flag I can set to change this
behavior or is there a better way to do what I'm doing?

Yes, localhost will get them all and the last one is being used.

Since you are not using hostnames in the inventory why not just use some fake hostname instead of localhost and keep ansible_connection=local.

Since ansible_connection is local it will still run on the localhost.

--
Kai Stian Olstad

--
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 post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/083a8e9d-5036-34d3-c945-78baf87d9d53%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to