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
About the Author
About the Reviewer

Configuring alternatives

Infrastructures are often configured in a manner where multiple files providing the same binary exists, and we configure alternatives to set the correct file that should provide the required binary and they are known as alternatives. In this recipe, we will learn how to configure alternatives in Salt.

How to do it...

We will use the same minion as the previous recipe. We will assume that there is a local web server in our environment, which provides an archived file containing a hotspot version of Java from Oracle:

  1. Create a new state directory called alternatives.

  2. Create and edit the /opt/salt-cookbook/staging/alternatives/init.sls file to have the following entries:

        - extracted
        - name: /opt/
        - source: http://reposerver/jdk-7u71-linux-x64.gz
        - source_hash: md5=22761b214b1505f1a9671b124b0f44f4
        - archive_format: tar
        - if_missing: /opt/jdk1.7.0_71
        - target: jdk1.7.0_71
        - require:...