Book Image

Salt Cookbook

By : Anirban Saha
Book Image

Salt Cookbook

By: Anirban Saha

Overview of this book

Table of Contents (18 chapters)
Salt Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Setting time zone, locale, and kernel configurations


In this recipe, we will see some simple yet important system configurations, with the help of respective Salt modules. We will learn how to set time zones, locales, and manage kernel parameter configurations.

How to do it...

We will use the same minion as the previous recipe. We will also use the same state hostconfig, and new configurations will be added in new files.

  1. Create and edit /opt/salt-cookbook/staging/hostconfig/timezone.sls to have the following entries:

    {% if grains['location'] == "dc1" %}
    Asia/Singapore:
    {% elif grains['location'] == "dc2" %}
    Europe/Amsterdam:
    {% endif %}
      timezone.system
  2. Create and edit /opt/salt-cookbook/staging/hostconfig/locale.sls to have the following entries:

    en_US.UTF-8:
      locale.system
  3. Create and edit /opt/salt-cookbook/staging/hostconfig/sysctl.sls to have the following entries:

    net.ipv4.conf.default.rp_filter:
      sysctl.present:
        - value: 1
    
    net.ipv4.tcp_syncookies:
      sysctl.present:
        - value: 1
  4. Edit...