Git Product home page Git Product logo

crvrs-saltstack's Introduction

Crvrs SaltStack

Repository for learning SaltStack. This repository is a mix of dev/learning modules, and live/production Salt resources.

The included salt-ctrl is a Python utility for generating scripts to run on master/minion nodes. Over time it may grow to more complex operations like copying/executing the scripts on the remote.

Notes

Port requirements

Port Type Description
4505 Event Publisher/Subscriber port (publish jobs/events) Constant inquiring connection
4506 Data payloads & minion returns (file services/return data) Connects only to deliver data

Bootstrap SaltStack installation

Commonly used bootstrap script options Additional bootstrap script options

  • -M: Install as Salt master
  • -P: Install from packages. Use pip if that fails
  • -U: Update all packages through OS system's package manager. This takes a long time.
  • -A <ip-address>: Declare IP/FQDN of Salt master that minion will connect to.
    • Ex: boostrap-salt.sh -A 192.168.1.5 stable 3006.4
      • Install Salt, point to 192.168.1.5 for the master node, install Salt version 3006.4 stable
    • Creates /etc/salt/minion.d/99-master-address.conf file
  • -i <some-minion-id>: Set the /etc/salt/minion_id file to the given ID. If not defined, defaults to minion's hostname.

Master node

Install SaltStack with the convenience script and -M flag (for "master")

curl -L https://bootstrap.saltstack.com -o install_salt.sh
sudo sh install_salt.sh -M

NOTE: On Ubuntu nodes, you must also use -P stable. The -P option installs packages with pip if they are not found.

After installing Salt on minion node(s), accept their keys on the master.

  • Check keys: salt-key -L
  • Accept all keys: salt-key -A

Minion node(s)

On each minion, install with the convenience script, omitting the -M flag

curl -L https://bootstrap.saltstack.com -o install_salt.sh
sudo sh install_salt.sh

NOTE: On Ubuntu nodes, you must also use -P stable. The -P option installs packages with pip if they are not found.

If you did not install Salt on the minion with the -A flag (specifying a Salt master IP/FQDN), edit /etc/salt/minion file, changing the line # master: salt to master: <ip/fqdn>.

Salt key management

On the Salt master, you can quickly view all Salt minion connections and view whether the connection is accepted, rejected, or pending.

salt-key --list-all

Before Salt minions can connect to the master, you need to accept the minion's key on the master node:

salt-key --accept=<key>

Optionally, but not recommended, you can accept all minion keys:

salt-key --accept-all

Configuring the Salt hostname

Salt minions attempt to contact the Salt master using the salt hostname. If you don't have DNS in your environment, or if the Salt master hostname is something other than salt, you can add the IP address of your Salt master server to the /etc/salt/minion configuration file by changing the master setting.

Ad-Hoc commands

Run ad-hoc commands with salt from the Master node. To check connectivity between the salt Master and a minion (or all minions, with salt "*"), run salt "*" test.version. This will print the minion's Salt version, proving a successful connection.

Helpful commands to know

  • test.version: Print the minion's Salt version
  • cmd: Run shell commands
    • Ex: salt "*" cmd.run "ls -l /etc/"
  • pkg: Maps local system package managers to the same salt functions. Examples:
    • pkg.install: Install a package using the OS's package manager
      • Ex: salt "*" pkg.install vim / salt "*" pkg.uninstall vim
  • network.interfaces: List all interfaces on a minion
    • Ex: salt "*" network.interfaces
  • Utilize Salt Grains
    • List available grains with salt "*" grains.ls
    • List grain data with salt "*" grains.items

Links

crvrs-saltstack's People

Contributors

pyvirus avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.