Skip to main content
  1. Main/
  2. How-To/

salt

·
Table of Contents
Incomplete This page content is incomplete. As I'm not using this project anymore will not be completed.

SaltStack is a configuration management and remote execution tool used to manage servers.

Here is a collection of steps I used to create my own saltstack master and configure minions.

Master with MySQL pillars #

The saltstack master is the control server all minions connect to. It specifies the packages and configuration files a minion should install and commands the minion has to run.

I’m running the master using the mysql backend for pillars.

  1. install salt-raet, for ArchLinux:

    pacman -Sy salt-zmq mysql-python
    
  2. create file root dir:

    mkdir -p salt/files
    
  3. configure master:

    hash_type: sha512
    file_roots:
      base:
        - /srv/salt/files/
    
  4. mysql:

    1. set timezone:

      mysql_tzinfo_to_sql /usr/share/zoneinfo/ | mysql -uroot mysql
      
    2. create databases:

      CREATE USER 'salt'@'localhost' IDENTIFIED BY 'CHANGEME';
      CREATE USER 'cmdb'@'localhost' IDENTIFIED BY 'CHANGEME';
      CREATE DATABASE cmdb;
      GRANT SELECT ON `cmdb`.* TO 'salt'@'localhost';
      GRANT ALL PRIVILEGES ON `cmdb`.* TO 'cmdb'@'localhost';
      USE cmdb;
      CREATE TABLE companies (id INT AUTO_INCREMENT PRIMARY KEY, company VARCHAR(255) UNIQUE NOT NULL);
      CREATE TABLE companies_projects (id INT AUTO_INCREMENT PRIMARY KEY, companyid INT NOT NULL, project VARCHAR(255) NOT NULL, CONSTRAINT `company` FOREIGN KEY (companyid) REFERENCES companies (id) ON DELETE CASCADE ON UPDATE RESTRICT);
      CREATE TABLE companies_projects_role (id INT AUTO_INCREMENT PRIMARY KEY, projectid INT NOT NULL, role VARCHAR(255) NOT NULL, CONSTRAINT `company_project` FOREIGN KEY (projectid) REFERENCES companies_projects (id) ON DELETE CASCADE ON UPDATE RESTRICT);
      CREATE TABLE pillars (id INT AUTO_INCREMENT PRIMARY KEY, roleid INT NOT NULL, pil1 VARCHAR(255) NOT NULL, pil2 VARCHAR(255) NOT NULL, pil3 VARCHAR(255) NOT NULL, pil4 VARCHAR(255) NOT NULL, pil5 VARCHAR(255) NOT NULL, pil6 VARCHAR(255) NOT NULL, pil7 VARCHAR(255) NOT NULL, CONSTRAINT `company_project_role` FOREIGN KEY (roleid) REFERENCES companies_projects_role (id) ON DELETE CASCADE ON UPDATE RESTRICT);