
Salt Cookbook
By :

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.
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
.
Edit the init.sls
file to have the following contents:
hosts_file: file.managed: - name: /etc/hosts - source: salt://hostconfig/files/hosts - user: root - hroup: root - mode: 644 - template: jinja - context: local_ip_address: {{ grains['ip4_interfaces']['eth1'][0]...
Change the font size
Change margin width
Change background colour