- Salt Cookbook
- Anirban Saha
- 303字
- 2021-07-16 13:21:58
Configuring nodegroups
A feature that makes Salt very efficient is its ability to configure nodegroups. They are groups of hosts that we can configure based on various system properties and use the group name to target minions. In this recipe, you will learn how to configure nodegroups.
How to do it...
- Edit the
/etc/salt/master
file on the Salt master and uncomment the keynodegroups
. Edit the lines following thenodegroups
key so that the entire nodegroups configuration looks as follows:nodegroups: stgdb: 'G@environment:staging and G@server_type:db' dc1devapp: 'G@location:dc1 and G@environment:development and G@server_type:app' prodmon: 'L@prddc1mon01,prddc2mon03,prddc3mon10'
- Restart the
salt-master
daemon for the changes to take place.
How it works...
In this recipe, we demonstrated how to configure nodegroups in various ways.
The nodegroups
key in the master configuration file needs to be uncommented and all entries under it are identified as configured nodegroups.
The first line is configured as follows:
stgdb: 'G@environment:staging and G@server_type:db'
This states that the group name is stgdb
, and it includes all nodes having the value of the environment grain as staging and the value of the server_type
grain as db
. The G@
parameter is used to specify grains and their values.
The second line defines a nodegroup called dc1devapp
that has a similar configuration to the first line with an extra grain called location
.
The third line defines a nodegroup called prodmon
and includes a list of hosts as mentioned in the configuration. The L@
parameter is used to specify a comma-separated list of minions.
These nodegroups can now be used to target minions.
See also
- The Configuring the Salt environment and pillar paths recipe, in Chapter 1, Salt Architecture and Components, to learn more about environments
- The Using grains in states recipe, to know more about configuring grains
- The Targeting minions recipe, to learn how to target minions using nodegroups
- Java范例大全
- Hands-On Machine Learning with scikit:learn and Scientific Python Toolkits
- PHP 從入門(mén)到項(xiàng)目實(shí)踐(超值版)
- 精通Scrapy網(wǎng)絡(luò)爬蟲(chóng)
- IoT Projects with Bluetooth Low Energy
- Java 9 Programming By Example
- CodeIgniter Web Application Blueprints
- Three.js權(quán)威指南:在網(wǎng)頁(yè)上創(chuàng)建3D圖形和動(dòng)畫(huà)的方法與實(shí)踐(原書(shū)第4版)
- UI動(dòng)效設(shè)計(jì)從入門(mén)到精通
- Python數(shù)據(jù)預(yù)處理技術(shù)與實(shí)踐
- Mastering Machine Learning with R
- Visual C#(學(xué)習(xí)筆記)
- Learn C Programming
- 計(jì)算機(jī)軟件項(xiàng)目實(shí)訓(xùn)指導(dǎo)
- Java程序設(shè)計(jì)基礎(chǔ)教程