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:
    extract_jdk_archive: archive: - extracted - name: /opt/ - ...

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.