Open derfian opened 5 years ago
One idea that's been stuck in my head is to have the cluster assignment as part of a host variable, which could be given like this in an inventory, or by any other means.
[thinlinc-servers]
some-master.example.com thinlinc_cluster=c1
some-agent-1.example.com thinlinc_cluster=c1
some-agent-2.example.com thinlinc_cluster=c1
other-master.example.com thinlinc_cluster=c2
other-agent-1.example.com thinlinc_cluster=c2
other-agent-2.example.com thinlinc_cluster=c2
I am not sure if this is the best approach, so I'm going to keep an eye out for other alternatives.
So after thinking about this for another while it would make more sense to "group" clusters based on a host group in Ansible. An obstacle for this is that I can't figure out a way to gather the agent servers within a clusters for a way to auto-assign /vsmserver/terminalservers so this will likely have to be exposed as a configurable variable for the user to fill in.
Just an idea (I haven't verified this). I might work to use the following hosts file:
[thinlinc-servers:children] Cluster1 Cluster2
[Cluster1:children] cl1_master cl1_agents
[Cluster2:children] cl2_master cl2_agents
[cl1_master] some-master.example.com
[cl1_agents] some-agent-1.example.com some-agent-2.example.com
[cl2_master] other-master.example.com
[cl2_agents] other-agent-1.example.com other-agent-2.example.com
Another idea would be to separate this into two roles, one for master and one for agent. We could then stop hard-coding group names, and leave it up to the playbook to determine which groups of servers are agents, masters, or both.
You could also have one inventory file per cluster, which would provide a cleaner separation between them. Of course, these days we have subclusters to deal with as well...
The way we assign servers into a ThinLinc cluster is currently based on the thinlinc-masters and thinlinc-agents groups, which could limit the use of this if you have more than one cluster to install. There's probably a better way to do this that would allow us to install servers into different clusters with different settings.