Configuring templates

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.

How to do it...

We will use the minion stgdc1log01 that we configured in the last recipe, Using state modules.

  1. Create a new state in the staging environment named hostconfig by creating a directory called hostconfig in the base directory of the staging environment. Create a directory called files in the hostconfig directory and also a file named init.sls.
  2. Edit the init.sls file to have the following contents: ...

Get Salt Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.