Minion! Mac OS
Minion! Mac OS
This document provides a step-by-step guide to installing a Salt clusterconsisting of one master, and one minion running on a local VM hosted on macOS.
Note
Minion Mac Os X
- The Charging Into Darkness Faction Box will provide you with all the Crystal Elf support you need to wage your own war against the undead! Containing +300% value of Crystal Elf cards, including the studious High-Mage Leiliel and 2 exclusive Crystal Elf cosmetics.
- The MinION software, MinKNOW, is compiled and run as a 64-bit application. 64-bit is required for utilising the 8 GB memory (or more in higher specification PCs). Please check you have requested this configuration if you are purchasing a new computer. Can I use a MAC to run your software? Yes MinKNOW will run on MAC OS X.
- For Mac OS X: LittleMinionComputer1.4.dmg.Once the disk image is mounted, drag the LMC application to the Applications folder to install. Whe you first run it, your OS may complain that it is from an unidentified developer: you should be able to right click on the applicaiton, select open and then run it.
Installing SaltStack's Salt Minion on a modern MacOS system can be quite daunting, especially as none of the existing directions from SaltStack or any site that I have found actually work. Since MacOSX El Capitan released, SIP security has made all tradi. Minion Movie Auditions 26,758x Free, for Mac. By operating system. Microsoft Windows (101) Apple Mac OS X (18) By price.
This guide is aimed at developers who wish to run Salt in a virtual machine.The official (Linux) walkthrough can be foundhere.
The 5 Cent Salt Intro¶
Minion Mc Skin
Since you're here you've probably already heard about Salt, so you alreadyknow Salt lets you configure and run commands on hordes of servers easily.Here's a brief overview of a Salt cluster:
Salt works by having a 'master' server sending commands to one or multiple'minion' servers. The master server is the 'command center'. It isgoing to be the place where you store your configuration files, aka: 'whichserver is the db, which is the web server, and what libraries and softwarethey should have installed'. The minions receive orders from the master.Minions are the servers actually performing work for your business.
Salt has two types of configuration files:
1. the 'salt communication channels' or 'meta' or 'config' configurationfiles (not official names): one for the master (usually is /etc/salt/master, on the master server), and one for minions (default is/etc/salt/minion or /etc/salt/minion.conf, on the minion servers). Thosefiles are used to determine things like the Salt Master IP, port, Saltfolder locations, etc.. If these are configured incorrectly, your minionswill probably be unable to receive orders from the master, or the masterwill not know which software a given minion should install.
2. the 'business' or 'service' configuration files (once again, not anofficial name): these are configuration files, ending with '.sls' extension,that describe which software should run on which server, along withparticular configuration properties for the software that is beinginstalled. These files should be created in the /srv/salt folder by default,but their location can be changed using ... /etc/salt/master configuration file!
Note
This tutorial contains a third important configuration file, not tobe confused with the previous two: the virtual machine provisioningconfiguration file. This in itself is not specifically tied to Salt, butit also contains some Salt configuration. More on that in step 3. Alsonote that all configuration files are YAML files. So indentation matters.
Note
Salt also works with 'masterless' configuration where a minion isautonomous (in which case salt can be seen as a local configuration tool),or in 'multiple master' configuration. See the documentation for more onthat.
Before Digging In, The Architecture Of The Salt Cluster¶
Salt Master¶
The 'Salt master' server is going to be the Mac OS machine, directly. Commandswill be run from a terminal app, so Salt will need to be installed on the Mac.This is going to be more convenient for toying around with configuration files.
Salt Minion¶
We'll only have one 'Salt minion' server. It is going to be running on aVirtual Machine running on the Mac, using VirtualBox. It will run an Ubuntudistribution.
Step 1 - Configuring The Salt Master On Your Mac¶
Because Salt has a lot of dependencies that are not built in macOS, we will useHomebrew to install Salt. Homebrew is a package manager for Mac, it's great, useit (for this tutorial at least!). Some people spend a lot of time installinglibs by hand to better understand dependencies, and then realize how useful apackage manager is once they're configuring a brand new machine and have to doit all over again. It also lets you uninstall things easily.
Note
Brew is a Ruby program (Ruby is installed by default with your Mac). Brewdownloads, compiles, and links software. The linking phase is when compiledsoftware is deployed on your machine. It may conflict with manuallyinstalled software, especially in the /usr/local directory. It's ok,remove the manually installed version then refresh the link by typingbrewlink'packageName'
. Brew has a brewdoctor
command that canhelp you troubleshoot. It's a great command, use it often. Brew requiresxcode command line tools. When you run brew the first time it asks you toinstall them if they're not already on your system. Brew installssoftware in /usr/local/bin (system bins are in /usr/bin). In order to usethose bins you need your $PATH to search there first. Brew tells you ifyour $PATH needs to be fixed.
Tip
Use the keyboard shortcut cmd+shift+period
in the 'open' macOSdialog box to display hidden files and folders, such as .profile.
Install Homebrew¶
Install Homebrew here https://brew.sh/
Or just type
Minion Mac Os Catalina
Now type the following commands in your terminal (you may want to type brewdoctor
after each to make sure everything's fine):
Note
zmq is ZeroMQ. It's a fantastic library used for server to server networkcommunication and is at the core of Salt efficiency.
Install Salt¶
You should now have everything ready to launch this command:
Note
There should be no need for sudopipinstallsalt
. Brew installedPython for your user, so you should have all the access. In case youwould like to check, type whichpython
to ensure that it's/usr/local/bin/python, and whichpip
which should be/usr/local/bin/pip.
Now type python
in a terminal then, importsalt
. There should be noerrors. Now exit the Python terminal using exit()
.
Create The Master Configuration¶
If the default /etc/salt/master configuration file was not created,copy-paste it from here:http://docs.saltstack.com/ref/configuration/examples.html#configuration-examples-master
Salt Master configuration changes. The Salt master needs a few customizationto be able to run on macOS:
In the /etc/salt/master file, change max_open_files to 8192 (or just add theline: max_open_files:8192
(no quote) if it doesn't already exists).
You should now be able to launch the Salt master:
There should be no errors when running the above command.
Note
This command is supposed to be a daemon, but for toying around, we'll keepit running on a terminal to monitor the activity.
Now that the master is set, let's configure a minion on a VM.
Step 2 - Configuring The Minion VM¶
The Salt minion is going to run on a Virtual Machine. There are a lot ofsoftware options that let you run virtual machines on a mac, But for thistutorial we're going to use VirtualBox. In addition to virtualBox, we will useVagrant, which allows you to create the base VM configuration.
Vagrant lets you build ready to use VM images, starting from an OS image andcustomizing it using 'provisioners'. In our case, we'll use it to:
Download the base Ubuntu image
Install salt on that Ubuntu image (Salt is going to be the 'provisioner'for the VM).
Launch the VM
SSH into the VM to debug
Stop the VM once you're done.
Install VirtualBox¶
Go get it here: https://www.virtualbox.org/wiki/Downloads (click on VirtualBoxfor macOS hosts => x86/amd64)
Install Vagrant¶
Go get it here: https://www.vagrantup.com/downloads.html and choose the latest version(1.3.5 at time of writing), then the .dmg file. Double-click to install it.Make sure the vagrant
command is found when run in the terminal. Typevagrant
. It should display a list of commands.
Create The Minion VM Folder¶
Create a folder in which you will store your minion's VM. In this tutorial,it's going to be a minion folder in the $home directory.
Initialize Vagrant¶
From the minion folder, type
This command creates a default Vagrantfile configuration file. Thisconfiguration file will be used to pass configuration parameters to the Saltprovisioner in Step 3.
Import Precise64 Ubuntu Box¶
Note
This box is added at the global Vagrant level. You only need to do itonce as each VM will use this same file.
Modify the Vagrantfile¶
Modify ./minion/Vagrantfile to use th precise64 box. Change the config.vm.box
line to:
Uncomment the line creating a host-only IP. This is the ip of your minion(you can change it to something else if that IP is already in use):
At this point you should have a VM that can run, although there won't be muchin it. Let's check that.
Checking The VM¶
From the $home/minion folder type:
A log showing the VM booting should be present. Once it's done you'll be backto the terminal:
The VM should respond to your ping request.
Now log into the VM in ssh using Vagrant again:
You should see the shell prompt change to something similar tovagrant@precise64:~$
meaning you're inside the VM. From there, enter thefollowing:
Note
That ip is the ip of your VM host (the macOS host). The number is aVirtualBox default and is displayed in the log after the Vagrant sshcommand. We'll use that IP to tell the minion where the Salt master is.Once you're done, end the ssh session by typing exit
.
It's now time to connect the VM to the salt master
Step 3 - Connecting Master and Minion¶
Creating The Minion Configuration File¶
Create the /etc/salt/minion
file. In that file, put thefollowing lines, giving the ID for this minion, and the IP of the master:
Minions authenticate with the master using keys. Keys are generatedautomatically if you don't provide one and can accept them later on. However,this requires accepting the minion key every time the minion is destroyed orcreated (which could be quite often). A better way is to create those keys inadvance, feed them to the minion, and authorize them once.
Preseed minion keys¶
From the minion folder on your Mac run:
This should create two files: minion1.pem, and minion1.pub.Since those files have been created using sudo, but will be used by vagrant,you need to change ownership:
Then copy the .pub file into the list of accepted minions:
Modify Vagrantfile to Use Salt Provisioner¶
Let's now modify the Vagrantfile used to provision the Salt VM. Add thefollowing section in the Vagrantfile (note: it should be at the sameindentation level as the other properties):
Now destroy the vm and recreate it from the /minion folder:
If everything is fine you should see the following message:
Minion Mac Os Download
Checking Master-Minion Communication¶
To make sure the master and minion are talking to each other, enter thefollowing:
You should see your minion answering with its salt version. It's now time to do someconfiguration.
Step 4 - Configure Services to Install On the Minion¶
In this step we'll use the Salt master to instruct our minion to installNginx.
Checking the system's original state¶
First, make sure that an HTTP server is not installed on our minion.When opening a browser directed at http://192.168.33.10/
You should get anerror saying the site cannot be reached.
Initialize the top.sls file¶
System configuration is done in /srv/salt/top.sls
(and subfiles/folders),and then applied by running the state.apply
function to have the Salt master order its minionsto update their instructions and run the associated commands.
First Create an empty file on your Salt master (macOS machine):
When the file is empty, or if no configuration is found for our minionan error is reported:
This should return an error stating: No Top file or external nodes datamatches found.
Create The Nginx Configuration¶
Now is finally the time to enter the real meat of our server's configuration.For this tutorial our minion will be treated as a web server that needs tohave Nginx installed.
Insert the following lines into /srv/salt/top.sls
(which should current beempty).
Now create /srv/salt/bin/nginx.sls
containing the following:
Check Minion State¶
Finally, run the state.apply
functionagain:
You should see a log showing that the Nginx package has been installedand the service configured. To prove it, open your browser and navigate tohttp://192.168.33.10/, you should see the standard Nginx welcome page.
Congratulations!
Where To Go From Here¶
A full description of configuration management within Salt (sls files amongother things) is available here:http://docs.saltstack.com/en/latest/index.html#configuration-management
Minion! Mac OS