Salt Master

Note

A Salt master starts life as a minion.

To create the minion (which will become a master), follow the instructions in Salt Cloud - Install, followed by Digital Ocean or Rackspace

Log into your new master server as root

Install

Install salt master:

apt update
apt install salt-master

Configuration

vim /etc/salt/master
# uncomment the following lines:
# file_roots:
#   base:
#     - /srv/salt

# and uncomment the following lines:
# pillar_roots:
#   base:
#     - /srv/pillar

Then re-start the salt master:

service salt-master restart

Check out the sls and pillar files from your repository so they are in the following folder structure:

├── srv
│   ├── pillar
│   │   ├── db
│   │   ├── global
│   │   ├── README.rst
│   │   ├── service
│   │   ├── sites
│   │   └── top.sls
│   ├── salt
│   │   ├── db
│   │   ├── default
│   │   ├── devpi
│   │   ├── nginx
│   │   ├── README.rst
│   │   ├── solr
│   │   ├── ssh
│   │   ├── supervisor
│   │   ├── top.sls
│   │   ├── uwsgi
│   │   └── web
│   └── ssl

Java

Note

We are now using the default OpenJDK package, so don’t need this formula.

From Adding a Formula directory manually and salt-formula-java:

mkdir /srv/formulas
cd /srv/formulas
git clone https://github.com/salt-formulas/salt-formula-java.git
# vim /etc/salt/master
# add the 'salt-formula-java' folder to the 'base' of 'file_roots'

file_roots:
  base:
    - /srv/salt/
    - /srv/formulas/salt-formula-java
service salt-master restart

Add the java formula to the top.sls file in your states e.g:

# top.sls (states)
base:
  '*':
    - java
    - ssh.ssh

In your pillar, add the contents of openjdk-10.sls to the config/java.sls file. Then add config.java to servers (as required) e.g:

# top.sls (pillar)
'test-a':
  - config.java

Provision

The Salt pillar should be set-up to install the services you require for your master e.g:

base:
  'master':
    - global.yourcompany.users
    - service.yourcompany.devpi

To set-up your master, follow the instructions in Salt - Provision remembering to use localhost as the IP address of the master.