Package: salt-sproxy
Salt plugin for interacting with network devices, without running Minions.NoteThis is NOT a SaltStack product.InstallInstall this package where you would like to manage your devices from. In case
you need a specific Salt version, make sure you install it beforehand,
otherwise this package will bring the latest Salt version available instead.The package is distributed via PyPI, under the namesalt-sproxy.Execute:pipinstallsalt-sproxyDocumentationThe complete documentation is available athttps://salt-sproxy.readthedocs.io/en/latest/.UsageFirst off, make sure you have the SaltPillar Top filecorrectly defined
and theproxykey is available into the Pillar. For more in-depth
explanation and examples, checkthistutorial
from the official SaltStack docs.Once you have that, you can start usingsalt-sproxyeven without any Proxy
Minions or Salt Master running. To check, can start by executing:$salt-sproxy-La,b,c--preview-target-a-b-cThe syntax is very similar to the widely used CLI commandsalt, however the
way it works is completely different under the hood:salt-sproxy<target> <function> [<arguments>]Usgae Example:$salt-sproxycr1.thn.lontest.pingcr1.thn.lon:TrueOne of the most important differences betweensaltandsalt-sproxyis
that the former is aware of the devices available, thanks to the fact that the
Minions connect to the Master, thereforesalthas the list of targets
already available.salt-sproxydoes not have this, as it doesn’t require
the Proxy Minions to be up and connected to the Master. For this reason, you
will need to provide it a list of devices, or aRoster filethat provides
the list of available devices.The following targeting options are available:-E,--pcre: Instead of using shell globs to evaluate the target
servers, use pcre regular expressions.-L,--list: Instead of using shell globs to evaluate the target
servers, take a comma or space delimited list of servers.-G,--grain: Instead of using shell globs to evaluate the target
use a grain value to identify targets, the syntax for the target is the grain
key followed by a globexpression:"os:Arch*".-P,--grain-pcre: Instead of using shell globs to evaluate the target
use a grain value to identify targets, the syntax for the target is the grain
key followed by a pcre regular expression: “os:Arch.*”.-N,--nodegroup: Instead of using shell globs to evaluate the target
use one of the predefined nodegroups to identify a list of targets.-R,--range: Instead of using shell globs to evaluate the target
use a range expression to identify targets. Range expressions look like
%cluster.WarningSome of the targeting options above may not be available for some Roster
modules.To use a specific Roster, configure theproxy_rosteroption into your
Master config file, e.g.,proxy_roster:ansibleWith the configuration above,salt-sproxywould try to use theansbile
Roster moduleto compile the Roster file (typically/etc/salt/roster) which is structured
as a regular Ansible Inventory file. This inventory should only provide the
list of devices.The Roster can also be specified on the fly, using the-Ror--rosteroptions, e.g.,salt-sproxycr1.thn.lon test.ping--roster=flat. In this
example, we’d be using theflat Roster moduleto determine the list of devices matched by a specific target.When you don’t specify the Roster into the Master config, or from the CLI, you
can usesalt-sproxyto target on or more devices using thegloborlisttarget types, e.g.,salt-sproxycr1.thn.lon test.ping(glob) orsalt-sproxy-Lcr1.thn.lon,cr2.thn.lon test.ping(to target a list of
devices, cr1.thn.lon and cr2.thn.lon, respectively).Note that in any case (with or without the Roster), you will need to provide
a valid list of Minions.