18 February 2016

Salt: Control a Mac Minion

Use Homebrew to install saltstack:
  1. Install Homebrew:
    1. Install XCode
    2. Load it to accept the Terms
    3. Install Homebrew:
      /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Ensure Homebrew is up to date:
    brew update
    brew upgrade
    brew doctor
  3. Install saltstack
    brew install saltstack
  4. Copy the Minion config file to resolve your host:
    sudo mkdir /etc/sudo
    sudo cp /usr/local/etc/saltstack/minion /etc/salt/minion
    sudo vi /etc/salt/minion
    Uncomment 'master: salt' and replace 'salt' with your salt hostname
  5. Start the Minion service to resolve the Master:
    sudo salt-minion -d
    If id doesn't run, try:
    sudo salt-minion --log-level=all
  6. Accept the key on the master:
    salt-key -L
    salt-key -A

To Setup the Salt Minion as a Daemon

  • You can run it from terminal:
    sudo salt-minion -d
  • Use the launchd system for OSX:
      1. Use LaunchControl to create a plist file
      2. Move it to
        /Library/LaunchDaemons
    • Use launchctl to enable it:
      sudo launchctl load -w /Library/LaunchDaemons/com.saltstack.salt.minion.plist
      sudo launchctl unload /Library/LaunchDaemons/com.saltstack.salt.minion.plist 
Great resource on plist files from Nathan Grigg here:
http://nathangrigg.net/2012/07/schedule-jobs-using-launchd/

No comments:

Post a Comment