<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Raymond P. Burkholder - Things I Do - Salt</title>
    <link>http://blog.raymond.burkholder.net/</link>
    <description>In And Around Technology and The Arts</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.7.2 - http://www.s9y.org/</generator>
    <pubDate>Wed, 19 Jul 2023 02:15:21 GMT</pubDate>

    <image>
        <url>http://blog.raymond.burkholder.net/templates/bulletproof/img/s9y_banner_small.png</url>
        <title>RSS: Raymond P. Burkholder - Things I Do - Salt - In And Around Technology and The Arts</title>
        <link>http://blog.raymond.burkholder.net/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>SaltStack on Debian Bookworm</title>
    <link>http://blog.raymond.burkholder.net/index.php?/archives/1241-SaltStack-on-Debian-Bookworm.html</link>
            <category>Debian</category>
            <category>Python</category>
            <category>Salt</category>
    
    <comments>http://blog.raymond.burkholder.net/index.php?/archives/1241-SaltStack-on-Debian-Bookworm.html#comments</comments>
    <wfw:comment>http://blog.raymond.burkholder.net/wfwcomment.php?cid=1241</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=1241</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;I found out the hard way that SaltStack and Debian no longer place nice together.  I had upgraded a Debian installation from Bullseye to Bookworm, along with the resident Salt Minion.  When attempting to use the minion, it no longer starts up, due to various imports no longer working.  Which was due to the salt-minion not being upgraded.  The error message would started this odyssey:

&lt;blockquote&gt;&lt;pre&gt;
salt ImportError: cannot import name &#039;Markup&#039; from &#039;jinja2&#039;
&lt;/pre&gt;&lt;/blockquote&gt;

&lt;p&gt;Taking a look at the &lt;a href=&quot;https://tracker.debian.org/pkg/salt&quot; target=_blank&gt;Debian Developer Information for Salt&lt;/a&gt;, the last version started in &#039;unstable&#039; was 3004.1 back in December of 2022.  This is now almost 8 months later and little or no movement.  There was some mention in a ticket somewhere that Salt release cycles don&#039;t cater to Debian stable release cycles.  Not sure if that is a legitimate reason or not, but, well, for whatever reason, SaltStack management in Debian is no longer a simple no brainer.

&lt;p&gt;However, after a little digging, there is a way to run SaltStack versions 3006 (current as of this writing).  It is simple to install on Bullseye, but not easily done on Bookworm.

&lt;p&gt;On Bullseye (as root, or implies sudo):

&lt;blockquote&gt;
# cd ~
# apt remove salt-minion salt-master
# apt install curl
# curl -L https://bootstrap.saltstack.com -o install_salt.sh
# sh install_salt.sh -M onedir
&lt;/blockquote&gt;

&lt;p&gt;The &#039;-M&#039; installs the salt master at the same time (for machines running master).  If you forget to do that, you&#039;ll need to diagnose and fix the systemctl mask error with the following:

&lt;blockquote&gt;
# apt install file
# file /etc/systemd/system/salt-master.service
# rm /etc/systemd/system/salt-master.service
# systemctl daemon-reload
# sh install_salt.sh -M onedir
&lt;/blockquote&gt;

&lt;p&gt;The &#039;sh install_salt.sh -M onedir&#039; should show a symlink to /dev/nul, which the &#039;rm ...&#039; will fix.

&lt;p&gt;On Bookworm, the bootstrap isn&#039;t scheduled to work till beginning of 2024 sometime I think with Salt 3007 or 3008 -- more info in &lt;a href=&quot;https://github.com/saltstack/salt/issues/64223&quot; target=_blank&gt;[FEATURE REQUEST] Add Salt support for Debian 12 #64223 &lt;/a&gt;.

&lt;p&gt;In the meantime, I had to cheat a bit:

&lt;ul&gt;
  &lt;li&gt;in /etc/debian_version, change 12.0 to 11.0
  &lt;li&gt;in /etc/apt/sources.list, change bookworm to bullseye
  &lt;li&gt;rm /etc/apt/sources.list.d/salt.list
  &lt;li&gt;run apt update
  &lt;li&gt;run the commands listed above for installing the one or both the salt services
  &lt;li&gt;restore /etc/debian_version and /etc/apt/sources.list to their original content
  &lt;/ul&gt;

&lt;p&gt;I&#039;m sure there are more elegant ways of doing this, but this worked to fake the needed version 11 in the installation script and directory traversal requirements

&lt;p&gt;Note, more info on the &lt;a href=&quot;https://docs.saltproject.io/en/getstarted/fundamentals/install.html&quot; target=_blank&gt;Salt Install/Bootstrap Process&lt;/a&gt;.
 
    </content:encoded>

    <pubDate>Wed, 19 Jul 2023 01:09:49 +0000</pubDate>
    <guid isPermaLink="false">http://blog.raymond.burkholder.net/index.php?/archives/1241-guid.html</guid>
    
</item>
<item>
    <title>SaltStack Orchestration for SSH Known_Hosts File</title>
    <link>http://blog.raymond.burkholder.net/index.php?/archives/879-SaltStack-Orchestration-for-SSH-Known_Hosts-File.html</link>
            <category>Salt</category>
    
    <comments>http://blog.raymond.burkholder.net/index.php?/archives/879-SaltStack-Orchestration-for-SSH-Known_Hosts-File.html#comments</comments>
    <wfw:comment>http://blog.raymond.burkholder.net/wfwcomment.php?cid=879</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=879</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;I run check_mk for monitoring some servers.  Currently, the check_mk host uses ssh connections to acquire the data from the check_mk monitored host.  

&lt;p&gt;&lt;a href=&quot;https://garthwaite.org/saltmine_check_mk_agent.html&quot; target=_blank&gt;Journey into the SaltMine to keep nagios fed with check_mk&lt;/a&gt; shows some ways of not using ssh, but to use minion/master interactions to capture the data.  I am leaning towards revisiting this by using SaltStack&#039;s inotify beacon to signal captured file changes, which then trigger events and orchestration to transfer the data from the minion/host to the check_mk/monitor.  And I think it can be done in a way such that the salt master doesn&#039;t necessarily need to reside on the check_mk monitor.  [as a note, the article shows some file locking mechanisms which might come in handy when I try to tackle this].

&lt;p&gt;But, first, I wanted to prove the theory in a different scenario. This example uses three hosts:   

&lt;ul&gt;
  &lt;li&gt;monitored host, which is running the salt-minion, and on to which the check_mk monitoring agent is to be installed,
  &lt;li&gt;monitoring host, which is check_mk, and also has a salt-minion installed, and the
  &lt;li&gt;salt-master, which controls the state and interactions between hosts
  &lt;/ul&gt;

&lt;p&gt;The monitoring host will use ssh to connect to the monitored host and access the agent.  During the first ssh session, a manual intervention is typically required to confirm usage of the destination&#039;s public host key, which then goes into the ~/.ssh/known_hosts file.  &#039;-o StrictHostKeyChecking=no&#039; could be used as a simple work-around, but is not very security conscious.  Instead, I came up with a series of SaltStack events and states to get the monitored host&#039;s public key into the monitoring host&#039;s known_hosts file.

&lt;p&gt;There are a number of key sets in use:

&lt;ul&gt;
  &lt;li&gt;When check_mk connects to an agent via ssh, it will typically use a local private key, and will require a shared public key in the monitored host&#039;s ~/.ssh/authorized_keys file.  I use SaltStack states and pillars to distribute and install the public key, and make use of the &quot;command=&quot;/usr/bin/check_mk_agent&quot; option in the authorized_keys file
  &lt;li&gt;Each host has a unique public/private key.  SSH uses this to prevent man in the middle attacks, and to ensure the host hasn&#039;t changed.  This blog entry is about getting this monitored host&#039;s public key into the monitoring host&#039;s known_hosts file.
  &lt;/ul&gt;

 &lt;br /&gt;&lt;a href=&quot;http://blog.raymond.burkholder.net/index.php?/archives/879-SaltStack-Orchestration-for-SSH-Known_Hosts-File.html#extended&quot;&gt;Continue reading &quot;SaltStack Orchestration for SSH Known_Hosts File&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Sun, 31 Dec 2017 19:19:44 +0000</pubDate>
    <guid isPermaLink="false">http://blog.raymond.burkholder.net/index.php?/archives/879-guid.html</guid>
    
</item>
<item>
    <title>SaltStack Articles</title>
    <link>http://blog.raymond.burkholder.net/index.php?/archives/783-SaltStack-Articles.html</link>
            <category>Salt</category>
    
    <comments>http://blog.raymond.burkholder.net/index.php?/archives/783-SaltStack-Articles.html#comments</comments>
    <wfw:comment>http://blog.raymond.burkholder.net/wfwcomment.php?cid=783</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=783</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;I had thought that the Reactor engine could use pillar states when running states for minions.  It may or may not have worked in the future.  For the present, it is confirmed as not working: &lt;a href=&quot;https://github.com/saltstack/salt/issues/42762&quot; target=_blank&gt;Pillars not available to reactor states #42762&lt;/a&gt;.  This refers to another issue which supposedly resolves everything in v2017.7.1: &lt;a href=&quot;https://github.com/saltstack/salt/pull/42433&quot; target=_blank&gt;Only force saltenv/pillarenv to be a string when not None #42433&lt;/a&gt;.

&lt;p&gt;While discovering this issue, I have been thinking about ways to maintain temporary variables somewhere. I first looked at Thorium, but it doesn&#039;t seem to have a very flexible two-step look up system, as I need to access variables based upon minion_id, and service type.

&lt;p&gt;The consul pillar state seems to be used only on the master, but I am thinking something should be available on the minion, or accessible from the minion.  I thought of the sqlite state for this, but might be a bit heavy duty.

&lt;p&gt;While researching this issue, I came across other interesting Salt articles, which I book mark here, for possible future reference:

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/saltstack/salt/issues/42715&quot; target=_blank&gt;stretch repository is missing packages #42715&lt;/a&gt;: this is interesting because in order to load 2017.7.1, I would have to obtain it from the SaltStack repository (as debian doesn&#039;t have this yet), and since I run Stretch and Buster, this might cause some issues.
  &lt;li&gt;&lt;a href=&quot;https://articles.microservices.com/saltstack-able-microservices-architecture-fb3db2f3e8&quot; target=_blank&gt;SaltStack-able Microservices Architecture&lt;/a&gt;: Beating the challenge with SaltStack, upstart, consul, consul-template, logstash, etc.  An interesting article as it introduces the concept of a jinja macro.
  &lt;li&gt;&lt;a href=&quot;https://fabianlee.org/2017/05/12/saltstack-combine-multiple-pillar-files-under-a-single-key/&quot; target=_blank&gt;Combine multiple pillar files under a single key&lt;/a&gt;: uses the &#039;multiple app needs logrotate entries&#039; problem to introduce the concept of merge, os_family_map (which has another issue in github), and jinja &#039;do&#039; statements.
  &lt;li&gt;&lt;a href=&quot;https://github.com/saltstack/salt/issues/34458&quot; target=_blank&gt;Salt consul pillar list of dicts #34458&lt;/a&gt;: not necessarily directly relevant, but does have a link to the &lt;a href=&quot;http://yaml.org/spec/1.2/spec.html&quot; target=_blank&gt;YAML v1.2 Specifications&lt;/a&gt;.
  &lt;li&gt;&lt;a href=&quot;https://opencredo.com/saltstack-using-consul-as-an-external-pillar-source/&quot; target=_blank&gt;Using Consul as an External Pillar Source&lt;/a&gt;: a simple, detailed way of using Consul for pillar based data for common data as well as minion specific private data.
  &lt;li&gt;Two entries here from the same blogger:  &lt;a href=&quot;http://bencane.com/2016/03/22/self-managing-servers-with-masterless-saltstack-minions/&quot; target=_blank&gt;Create self-managing servers with Masterless Minions&lt;/a&gt; and &lt;a href=&quot;http://bencane.com/2016/07/19/using-salt-ssh-to-install-salt/&quot; target=_blank&gt;Using salt-ssh to install Salt&lt;/a&gt;, with a bonus reference: &lt;a href=&quot;http://bencane.com/2014/02/04/saltstack-getting-redundancy-and-scalability-with-multiple-master-servers/&quot; target=_blank&gt;Getting redundancy and scalability with multiple master servers&quot;&lt;/a&gt;
  &lt;li&gt;&lt;a href=&quot;http://talks.caktusgroup.com/lightning-talks/2013/salt-master/#slide2&quot; target=_blank&gt;Managing your computers with a Salt Master and Git&lt;/a&gt;.
  &lt;li&gt;&lt;a href=&quot;https://medium.com/@jmarhee/some-notes-on-using-saltstack-at-home-9bca22347f5a&quot; target=_blank&gt;Some notes on using SaltStack&lt;/a&gt;: centers the discussion around roles.
  &lt;li&gt;&lt;a href=&quot;https://opencredo.com/saltstack-using-consul-as-an-external-pillar-source/&quot; target=_blank&gt;Using Consul as an External Pillar Source&lt;/a&gt;
  &lt;li&gt;&lt;a href=&quot;https://linuxacademy.com/howtoguides/posts/show/topic/15862-saltstack-orchestration-beacons-and-reactors&quot; target=_blank&gt;SaltStack orchestration with Beacons and Reactors&lt;/a&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.packtpub.com/books/content/thorium-and-salt-api&quot; target=_blank&gt;Thorium and Salt API&lt;/a&gt; chapter extract from a book called &quot;Mastering SaltStack&quot;.
  &lt;li&gt;&lt;a href=&quot;https://ripe74.ripe.net/wp-content/uploads/presentations/18-RIPE-74-Network-automation-at-scale-up-and-running-in-60-minutes.pdf&quot; target=_blank&gt;Network Automation at Scale: Up and Running in 60 Minutes&lt;/a&gt;: an excellent tutorial on orchestration at scale, from a RIPE 74 presentation.
  &lt;li&gt;&lt;a href=&quot;http://intothesaltmine.readthedocs.io/en/latest/chapters/secret-storage/requirements.html&quot; target=_blank&gt;Salt-based secret storage solution&lt;/a&gt; - many of the chapters are incomplete, but this has content.
  &lt;/ul&gt; 
    </content:encoded>

    <pubDate>Mon, 07 Aug 2017 17:44:04 +0000</pubDate>
    <guid isPermaLink="false">http://blog.raymond.burkholder.net/index.php?/archives/783-guid.html</guid>
    
</item>
<item>
    <title>SaltStack - Automation with Salt - Interesting Pages</title>
    <link>http://blog.raymond.burkholder.net/index.php?/archives/692-SaltStack-Automation-with-Salt-Interesting-Pages.html</link>
            <category>Salt</category>
    
    <comments>http://blog.raymond.burkholder.net/index.php?/archives/692-SaltStack-Automation-with-Salt-Interesting-Pages.html#comments</comments>
    <wfw:comment>http://blog.raymond.burkholder.net/wfwcomment.php?cid=692</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://blog.raymond.burkholder.net/rss.php?version=2.0&amp;type=comments&amp;cid=692</wfw:commentRss>
    

    <author>nospam@example.com (Raymond P. Burkholder)</author>
    <content:encoded>
    &lt;p&gt;I have been using Salt for a number of infrastructure automation projects.  Still a lot to learn.  For me, it is an excellent &#039;as built&#039; documentation tool.  Not to mention the time saving and repeatability of building, rebuilding, and supporting infrastructure.

&lt;p&gt;Some links I use, and want to keep around:

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://docs.saltstack.com/en/latest/ref/netapi/all/salt.netapi.rest_cherrypy.html&quot; target=_blank&gt;rest_cherrypy&lt;/a&gt;: A REST API for Salt
  &lt;li&gt;&lt;a href=&quot;https://kitchen.saltstack.com/&quot; target=_blank&gt;kitchen-salt&lt;/a&gt;: A Test Kitchen Provisioner for Salt.  The provider works by generating a salt-minion config, creating pillars based on attributes in .kitchen.yml and calling salt-call. This provisioner is tested with kitchen-docker against CentOS, Ubuntu, and Debian.
  &lt;li&gt;&lt;a href=&quot;https://docs.saltstack.com/en/latest/topics/projects/index.html&quot; target=_blank&gt;Salt Community Projects&lt;/a&gt;:  The one currently at the top of the list:  &lt;a href=&quot;https://hubblestack.io/&quot; target=_blank&gt;HubbleStack&lt;/a&gt;.  &quot;... on-demand profile-based auditing, real-time security event notifications, automated remediation, alerting and reporting&quot;
  &lt;/ul&gt; 
    </content:encoded>

    <pubDate>Tue, 25 Oct 2016 12:29:24 +0000</pubDate>
    <guid isPermaLink="false">http://blog.raymond.burkholder.net/index.php?/archives/692-guid.html</guid>
    
</item>

</channel>
</rss>
