Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Salt Cookbook
  • Table Of Contents Toc
  • Feedback & Rating feedback
Salt Cookbook

Salt Cookbook

By : Anirban Saha
3.5 (2)
close
close
Salt Cookbook

Salt Cookbook

3.5 (2)
By: Anirban Saha

Overview of this book

If you are a professional associated with system and infrastructure management, looking at automated infrastructure and deployments, then this book is for you. No prior experience of Salt is required.
Table of Contents (13 chapters)
close
close
12
Index

Using requisites

In infrastructure management, almost all the time, we have situations where we need a task to happen only if another condition is true. This is achieved by creating dependencies between definitions. In Salt, these dependencies are known as requisites, and in this recipe, you will learn about how to use them.

How to do it...

We will use the same minion as the previous recipe.

  1. Create a new state called ntp by creating a directory called ntp in the base directory of the staging environment, and then create a directory called files in the ntp state directory.
  2. Create a file called init.sls in the ntp state directory and edit it to have the following entries:
    ntp_package:
      pkg.installed:
        - name: ntp
    
    ntp_conf_file:
      file.managed:patch antenna circular polarization
        - name: /etc/ntp.conf
        - source: salt://ntp/files/ntp.conf
        - user: root
        - group: root
        - mode: 644
        - require:
          - pkg: ntp_package
    
    ntp_service:
      service:
        - name: ntpd
        - running
    ...

Unlock full access

Continue reading for free

A Packt free trial gives you instant online access to our library of over 7000 practical eBooks and videos, constantly updated with the latest in tech

Create a Note

Modal Close icon
You need to login to use this feature.
notes
bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Delete Note

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Edit Note

Modal Close icon
Write a note (max 255 characters)
Cancel
Update Note

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY