NETWAYS / ansible-collection-elasticstack

A collection to install and manage the Elastic Stack
GNU General Public License v3.0
9 stars 8 forks source link

Allow to set node types for elasticsearch #136

Closed widhalmt closed 1 year ago

widhalmt commented 1 year ago

fixes #66 fixes #137

You can now set a new variable to set all the node types. If you don't set it, it will stay at the default of "every node has every role".

Since having an odd count of master nodes is important, we built in a check that will assure you have the right count.

widhalmt commented 1 year ago

I changed this to draft because something in the calculation of master nodes isn't right. I tried different approaches with temporary files and other humble makeshift solutions. @afeefghannam89 , @Saeid-Abadi and @Donien showed me a nicer approach. Now it only needs to work. ;-)

Note: The current code shouldn't go through the tests. I pushed a draft where the check should actually fail due to a wrong count of master nodes.

widhalmt commented 1 year ago

The new approach with setting some variables and creating groups is all but "sophisticated". But it's simple enough that it should work reliably and even more, it has some nice sideeffects that we might benefit from later. Having groups of master-nodes and data-nodes could be beneficial.

Of course I could just have the user set the variables we're setting. But I like the idea of using a list of roles to configure. We don't know whether there will come new ones or what combinations users might use. Then just setting variables we need for easier handling is a bit cumbersome, but hey, it works.

widhalmt commented 1 year ago

Had to exclude a new linter rule to proceed. Please see #159 for details.

widhalmt commented 1 year ago

Thank you so much, @afeefghannam89 for finding https://www.elastic.co/guide/en/elasticsearch/reference/current/bootstrap-checks.html#single-node-discovery This should be it!

widhalmt commented 1 year ago

When all the checks pass, I still need to remove all the debug changes.