michmill
michmill

Reputation: 73

Define node groups outside of /etc/salt/master

Is it possible to define nodegroups outside of the master config file (/etc/salt/master). It seems that something as dynamic node groups shouldn't be in the master config, or am I thinking about nodegroups the wrong way.

Here's my scenario, our servers are classified by role in their naming convention. Which means we have multiple servers named location-nginxXX.mydomain.com, where the XX denotes the node. The applications on the node can/will change over time. As we move an application from one node to another we want to target the new node with additional states and pillar items. Ideally, we'd update some config (pillar, maybe?) with the list of servers assigned to a given application. Then we update the servers with the states for the new application, and remove the states no longer needed.

Is our approach sound, and if so, how do you target a changing set of minions with states and pillars?

Upvotes: 2

Views: 1123

Answers (2)

sjas
sjas

Reputation: 19667

You could use an ENC (external node classifier) - either build your own one, or use something like reclass.

Upvotes: 0

match
match

Reputation: 11060

If you're using nodegroups 'dynamically' then this is usually done using one of the compound matchers. you define a nodegroup (in master) that matches something that can be changed elsewhere in the config (grains being the most common, but pillars also works). When you want to change a server's group, just modify it's config to be matched by a different nodegroup.

Upvotes: 1

Related Questions