In infrastructure management, we often face situations when we have to push files to multiple hosts but the information in the files is host-specific such as the hostname, IP address, and so on. In Salt, we can achieve the same objectives using templates, and in this recipe, we are going to learn about how to use templates.
We will use the minion
stgdc1log01 that we configured in the last recipe, Using state modules.
hostconfigby creating a directory called
hostconfigin the base directory of the staging environment. Create a directory called
hostconfigdirectory and also a file named
init.slsfile to have the following contents: ...