Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wiki] use:saltstack #56

Open
sjorge opened this issue Dec 23, 2017 · 3 comments
Open

[wiki] use:saltstack #56

sjorge opened this issue Dec 23, 2017 · 3 comments

Comments

@sjorge
Copy link

@sjorge sjorge commented Dec 23, 2017

Introduction

This document describes how to set up a salt-master using pkgsrc packages available on SmartOS. Most of the information is applicable to other pkgsrc platforms but you may need to change paths and init services.

This was all done using the following image: 23b267fc-ad02-11e7-94da-53e3d3884fe0

what is saltstack

Saltstack is a modern tool for IT automation, it offers both configuration management, remote command execution, and much more. Here after refered to as salt.

It can both be use in a standalone mode and a mode where all minions (clients) talk to a master. In this guide we will cover bootstrapping a master from a minion running in standalone mode.

setting up the salt-master

We will use salt to setup our salt-master, we call this node salt.example.org.
The initial execution will be salt in standalone mode.

installing the packages

: Install package
$ pkgin -y install salt py27-pygit2 git-base

: Edit the minion config file
$ vi /opt/local/etc/salt/minion

/opt/local/etc/salt/minion

####
## bootstrap configuration (standalone)
####
## minion id
# NOTE: we set both the id and append_domain beacause we are running
#       on illumos where socket.getfqdn() does not behave properly from
#       salt's perspective.
id: salt
append_domain: example.org

## configure local pillar/state storage and the salt-formula from git
file_client: local
file_roots:
  base:
    - /var/salt/file-roots
pillar_roots:
  base:
   - /var/salt/pillar-roots
fileserver_backend:
  - roots
  - git
gitfs_remotes:
  - http://github.com/saltstack-formulas/salt-formula.git

# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2

create a bare minimal salt environment

Here we create a bare minimal salt environment that manages the salt-master on salt.example.org and will manage the salt-minion on all other nodes.

: Lets explorer what salt knows about our system
salt-call grains.items

: Find out if we are identified as salt.example.org (FQDN, also id and domain set earlier)
salt-call grains.get id

We make sure that salt identifies us correctly. More information about grains can be find in the SaltStack Docs

: Create a top.sls for our states
$ vi /var/salt/file-roots/top.sls

: Create top.sls for our pillar
$ vi /var/salt/pillar-roots/top.sls

: Create salt.sls to hold our salt-master/minion configuration
$ vi /var/salt/pillar-roots/salt.sls

: Override some salt configuration if we are the salt-master node.
$ mkdir -p /var/salt/pillar-roots/minion/
$ vi /var/salt/pillar-roots/minion/salt_example_org.sls

: Bootstrap ourselves
$ salt-call state.apply

: Accept our key so the master can talk to itself
$ salt-key -y -a salt.example.org

After this the master is still configured to work in standalone mode, this is by design.
In theory you can always rebootstrap the master this way.

To run salt standalone: salt-call state.apply
To run salt from the master on a minion: salt minion_id state.apply

Basically we said that salt.example.org should get both the salt.master and salt.minion state and all other nodes should get the salt.minion state. We provided those states with information they need to configure everything for us using the salt pillar.

There is a big collection of formulas available for other software, you can learn more here.

/var/salt/file-roots/top.sls

####
## top state
####
base:
  # NOTE: we bootstrap the last master
  'salt.example.org':
    - salt.master
  # NOTE: manage minion configuration on all nodes
  '*':
    - salt.minion

# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2

/var/salt/pillar-roots/top.sls

[root@salt /var/salt/pillar-roots]# cat top.sls
####
## top pillar
####
{% set safe_id = salt['grains.get']('id')|replace('.', '_') %}
base:
  # NOTE: on all minions we include:
  #       - salt configuration
  #       - minion specific overrides
  '*':
    - salt
{% if salt['file.file_exists']('minion/{0}.sls'.format(safe_id)) %}
    - minion.{{ safe_id }}
{% endif %}

# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2

/var/salt/pillar-roots/salt.sls

####
## salt configuration
####
salt:
  append_domain: example.org
  master_remove_config: True
  minion_remove_config: True
  minion:
    master: salt.example.org

# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2

/var/salt/pillar-roots/minion/salt_example_org.sls

####
## salt master configuration
####
salt:
  ## NOTE: configure the salt master
  master:
    fileserver_backend:
      - roots
      - git
    gitfs_remotes:
      - https://github.com/saltstack-formulas/salt-formula.git
    file_roots:
      base:
        - /var/salt/file-roots
    pillar_roots:
      base:
        - /var/salt/pillar-roots
  ## NOTE: configure this salt minion to work standalone
  minion:
    id: salt
    append_domain: example.org
    file_client: local
    fileserver_backend:
      - roots
      - git
    gitfs_remotes:
      - https://github.com/saltstack-formulas/salt-formula.git
    file_roots:
      base:
        - /var/salt/file-roots
    pillar_roots:
      base:
        - /var/salt/pillar-roots

# vim: tabstop=2 expandtab shiftwidth=2 softtabstop=2

setting a new minion

Now that we have a master, we want some minions we can manage and configure.

installing the packages

: Install package
$ pkgin -y install salt

: Announce the minion to the master
$ mkdir -p /opt/local/etc/salt/pki/minion
$ salt-call --master=salt.example.org --id=saltmin.example.org test.ping

: Accept the minion's key on the master
$ salt-key -y -a minion_id

: Bootstrap the minion
$ salt-call --master=salt.example.org --id=saltmin.example.org state.apply
@sjorge

This comment has been minimized.

Copy link
Author

@sjorge sjorge commented Dec 23, 2017

Couldn't figure out how to create a wiki-page and do a pull request for this, so doing it in the issue.

@sjorge sjorge changed the title [WIP] [wiki] use:saltstack [wiki] use:saltstack Dec 23, 2017
jperkin pushed a commit that referenced this issue Jan 9, 2018
Changes:
1.1.1
-----
 * Added support for:
    `slideshare` - <https://www.slideshare.net/> (#54)
 * Added pool- and post-extractors for `sankaku`
 * Added OAuth user authentication for `deviantart`
 * Updated `luscious` to support `members.luscious.net` URLs (#55)
 * Updated `mangahere` to use their new domain name (mangahere.cc) and mobile URLs
 * Updated `gelbooru` to not be restricted to the first 20,000 images (#56)
 * Fixed extraction issues for `nhentai` and `khinsider`
jperkin pushed a commit that referenced this issue Feb 2, 2018
Upstream changes:
Changes in DBI 1.640 - 28th January 2018

    Fix test t/91_store_warning.t for perl 5.10.0
        thanks to pali #57

    Add Perl 5.10.0 and 5.8.1 specific versions to Travis testing
        thanks to pali #57
    Add registration of mariadb_ prefix for new DBD::MariaDB driver
        thanks to pali #56
jperkin pushed a commit that referenced this issue Mar 14, 2018
2.0.0						2016/12/02

Development Fixes

* Update versions for Travis (#43)
* Define path with dir (#48)
* Remove version lock for dependency listen (#50)
* Inherit Jekyll's rubocop config for consistency (#51)
* Update jekyll-watch (#53)
* Drop support for old Ruby and old Jekyll (#55)

Minor Enhancements

* Output regenerated file paths to terminal (#57)

Major Enhancements

* Remove unnecessary method (#56)
jperkin pushed a commit that referenced this issue Dec 1, 2018
upstream changelog:

Changes in 3.7.1
2018-11-29

- Bug fixes / improvements
  - Fix crash in GEOSCoordSeq_isCCW with empty coordseq
    (#927, Sergey Fedoseev)
  - Fix crash in GEOSInterpolate with empty LineString
    (#926, Sergey Fedoseev)
  - Fix crash in GEOSUnaryUnion with empty LineString
    (#928, Sergey Fedoseev)
  - Fix memory leak in SIRtree::insert (#919, Dan Baston)
  - Reduce required autoconf to 2.63
    (#56, John Harvey)
  - Fix incorrect return values on error from GEOSLength
    GEOSisValidDetail (#941, Dan Baston)
jperkin pushed a commit that referenced this issue Nov 13, 2019
Add go mod version string
lru: add the missing GetOldest()
lru: don't kill the return values of Remove and RemoveOldest
Merge branch 'master' into resize
lru.Get(): avoid nil pointer dereference (#56)
Fix typo: 'exsists' (#50)
jperkin pushed a commit that referenced this issue Jan 3, 2020
0.14 (July 30, 2018)
Bug Fixes
* The state file that xmonad uses while restarting itself is now
  removed after it is processed. This fixes a bug that manifested in
  several different ways:
  * Names of old workspaces would be resurrected after a restart
  * Screen sizes would be wrong after changing monitor configuration
    (#90)
  * spawnOnce stopped working (xmonad/xmonad-contrib#155)
  * Focus did not follow when moving between workspaces (#87)
  * etc.
* Recover old behavior (in 0.12) when focusFollowsMouse == True: the
  focus follows when the mouse enters another workspace but not moving
  into any window.
* Compiles with GHC 8.4.1
* Restored compatability with GHC version prior to 8.0.1 by removing
  the dependency on directory version 1.2.3.

0.13 (February 10, 2017)
Breaking Changes
* When restarting xmonad, resume state is no longer passed to the next
  process via the command line. Instead, a temporary state file is
  created and xmonad's state is serialized to that file.
* When upgrading to 0.13 from a previous version, the --resume command
  line option will automatically migrate to a state file.
* This fixes issue #12.

Enhancements
* You can now control which directory xmonad uses for finding your
  configuration file and which one is used for storing the compiled
  version of your configuration. In order of preference:
  * New environment variables. If you want to use these ensure you set
    the correct environment variable and also create the directory it
    references:
    * XMONAD_CONFIG_DIR
    * XMONAD_CACHE_DIR
    * XMONAD_DATA_DIR
  * The ~/.xmonad directory.
  * XDG Base Directory Specification directories, if they exist:
    * XDG_CONFIG_HOME/xmonad
    * XDG_CACHE_HOME/xmonad
    * XDG_DATA_HOME/xmonad
* If none of these directories exist then one will be created using
  the following logic: If the relevant environment variable mentioned
  in step (1) above is set, the referent directory will be created and
  used. Otherwise ~/.xmonad will be created and used.
* This fixes a few issues, notably #7 and #56.
* A custom build script can be used when xmonad is given the
  --recompile command line option. If an executable named build exists
  in the xmonad configuration directory it will be called instead of
  ghc. It takes one argument, the name of the executable binary it
  must produce.
* This fixes #8. (One of two possible custom build solutions. See the
  next entry for another solution.)
* For users who build their xmonad configuration using tools such as
  cabal or stack, there is another option for executing xmonad.
* Instead of running the xmonad executable directly, arrange to have
  your login manager run your configuration binary instead. Then, in
  your binary, use the new launch command instead of xmonad.
* This will keep xmonad from using its configuration file
  checking/compiling code and directly start the window manager
  without execing any other binary.
* See the documentation for the launch function in XMonad.Main for
  more details.
* Fixes #8. (Second way to have a custom build environment for
  XMonad. See previous entry for another solution.)
jperkin pushed a commit that referenced this issue Mar 22, 2020
2.64.1: (stable):

Glib:
* Add missing #includes
  (Kjell Ahlstedt) Issue #69 (Kalev Lember)


2.64.0 (stable):

Glib:
* Add get_user_runtime_dir()
  (scx) Issue #57, merge request !14
* Add get_host_name()
  (scx) Issue #58, merge request !15
* MainContext: Add push/pop/get_thread_default()
  (Kjell Ahlstedt) Issue #56 (Yackie-Yang)
* Add StdStringView and UStringView
  Use them in build_filename()
  (Thomas Holder, Kjell Ahlstedt) Issue #34
* Regex: match(), match_all(): Deprecate rvalue string references
  (Thomas Holder, Kjell Ahlstedt) Issue #66, merge request !26
* Add Glib::canonicalize_filename()
  (Kjell Ahlstedt) Issue #59 (Patrick Storz)
* ustring: Fix insert(iterator, In, In)
  (Thomas Holder) Merge request !19

Gio:
* DBus::Connection: Make the wrap() function thread-safe
  (Kjell Ahlstedt) Issue #56 (Yackie-Yang)
* DBus::Message::get_unix_fd_list(): Add refreturn
  (Kjell Ahlstedt) Issue #68 (kr.woaini)

gmmproc:
* Add optional decl_prefix parameter to _CLASS_BOXEDTYPE,
  _CLASS_BOXEDTYPE_STATIC, _CLASS_GOBJECT, _CLASS_INTERFACE,
  _CLASS_OPAQUE_COPYABLE, _CLASS_OPAQUE_REFCOUNTED, _WRAP_GERROR
  Used for adding GLIBMM_API or similar for MS Visual C++
  (Chun-wei Fan)

Build:
* Add Meson support
  (Chun-wei Fan, Kjell Ahlstedt) Merge request !28
* Drop gendef from Windows builds
  (Chun-wei Fan) Issue #12 (Mikhail Titov), merge request !30

Documentation:
* Correct spelling of spawn_async_with_pipes()
  (Mike Fleetwood) Merge request !16
* Glib::Binding: Several doc improvements
  (Daniel Boles) Merge request !17
* Glib::Binding: Explain why SlotTransform takes GValue*
  (Kjell Ahlstedt) Issue #61 (Daniel Boles)
* Regex: Note that Glib::ustring must be used in match methods
  (Kjell Ahlstedt) Issue #66, merge request !26
* Gio::AsyncResult: Improve the class description
  (Kjell Ahlstedt) Issue #27 (Alberto Mardegan)
jperkin pushed a commit that referenced this issue Mar 25, 2020
Update ruby-mixlib-cli to 2.1.5.


2.1.5 (2019-12-22)

* Use our standard rakefile #68 (tas50)
* Fix chef-style #71 (vsingh-msys)
* Add windows PR testing with Buildkite #73 (tas50)
* Test on Ruby 2.7 + random testing improvements #75 (tas50)


2.1.1 (2019-06-10)

* Don't explode when there are unknown keys in 'config' #66 (marcparadise)


2.1.0 (2019-06-07)

* Setup BuildKite for PR testing #61 (tas50)
* Disable Travis testing & Update codeowners #62 (tas50)
* Fix gem homepage url #64 (tsub)
* [MIXLIB-CLI-63] Add deprecated_option support #65 (marcparadise)


2.0.6 (2019-05-14)

* Add additional github templates and update codeowners #58 (tas50)
* Improve the --help text output of 'in:' #59 (btm)
* Print out human readable lists of allowed CLI options #60 (tas50)


2.0.3 (2019-03-20)

* fix global state pollution issues across examples #54 (lamont-granquist)
* Add back support for Ruby 2.4 #56 (tas50)


2.0.1 (2019-01-04)

* Don't ship the test files in the gem artifact #51 (tas50)


2.0.0 (2019-01-04)

* remove hashrockets syntax #43 (lamont-granquist)
* Remove require rubygems #44 (tas50)
* Update testing and contributing boilerplate #45 (tas50)
* More testing / release boilerplate #46 (tas50)
* Update codeowners and add github PR template #47 (tas50)
* Lint the example code #49 (tas50)
* update travis, drop ruby < 2.5, major version bump #52 (lamont-granquist)
* actually do the major version bump #53 (lamont-granquist)
jperkin pushed a commit that referenced this issue Mar 25, 2020
Update ruby-mixlib-log to 3.0.8.


3.0.8 (2019-12-30)

* Expand testing / Update GitHub templates #51 (tas50)
* Add Build Kite PR Testing #52 (tas50)
* Remove Travis PR Testing #53 (tas50)
* Resolve all warnings emitted during testing #54 (zenspider)
* Add windows testing in Buildkite #56 (tas50)
* Test on Ruby 2.7 + random testing improvements #58 (tas50)
* Substitute require for require_relative #59 (tas50)


3.0.1 (2019-01-05)

* reverting back to ruby 2.3 support #48 (lamont-granquist)


3.0.0 (2019-01-04)

* update travis, drop ruby < 2.5, major version bump #47 (lamont-granquist)

2.0.9 (2018-12-18)

* remove hashrocket syntax #41 (lamont-granquist)
* Remove the changelog generator gem #42 (tas50)
* Test on all the Ruby versions we support #43 (tas50)
* Test on Ruby 2.6 in Travis + test on Xenial #46 (tas50)
* Only ship the required library files in the gem artifact #45 (tas50)
@jperkin jperkin closed this in 41ca3ae Apr 3, 2020
@sjorge

This comment has been minimized.

Copy link
Author

@sjorge sjorge commented Apr 3, 2020

@jperkin I guess this got closed by mistake?

@jperkin

This comment has been minimized.

Copy link
Collaborator

@jperkin jperkin commented Apr 3, 2020

Stupid GitHub auto-close.

@jperkin jperkin reopened this Apr 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.