What's new in Salt 3006 Sulfur LTS
16 minute read Updated:
If you do not have time to dig into all the cool stuff that went in, just read the LTS, Onedir, and Security sections because they will affect you sooner or later. For a shorter summary, check out the official announcement.
What's new in Salt 3006 Sulfur: LTS releases, Onedir (Relenv) packages, Security, State system enhancements, salt-ssh, Grains, Pillar, Slack Bolt engine, Jinja, Windows.
- LTS/STS release strategy
- Dot zero version number
- Relenv-based onedir packages
- Test suite improvements
- Native minion packages
- Security
- State system
- Salt SSH
- Grains
- Pillar
- Performance
- Slack Bolt engine
- Proxy
- TCP
- Jinja
- Windows
- Other notable changes
Want to read about the upcoming Argon release?
I’m always hesitant to commit to writing another post like this one (it takes a lot of time!). However, I get bits of motivation to do so when people subscribe to the mailing list.
Powered by Mailgit
LTS/STS release strategy
Salt 3006 is the first LTS release as defined in the new (Django-like) release strategy SEP. As with the previous release strategy change, the root cause is lack of development resources to provide security bug fixes and patches for all supported versions.
Instead of the previously expected release cadence of 3-4 months (declared since Salt Neon), we should see two releases per year - one LTS (long-term support) and one STS (short-term support). LTS will be supported for two years and is intended for those who want stability. STS will be supported for 6 months and is for users who want quicker access to the latest features.
For more details and support timeline graphs, please read the announcement blog post.
Dot zero version number
Salt Neon introduced the new versioning scheme that starts from 3000. That decision introduced a minor inconsistency - a major version does not have .0
while a minor one has the patch number. Then came SEP-33 that proposed to add the .0
back.
This SEP was implemented in PRs #62742 by Caleb Beard , #63256 by Megan Wilhite , #63638 by Pedro Algarvio , and #1879 by Gareth J. Greenaway
Relenv-based onedir packages
Starting in 3006, only onedir-based packages will be available. Furthermore, the 3006 onedir packages are built with the new Relenv tool (instead of PyInstaller, which apparently introduced too many compatibility problems). A relenv-based package is basically a relocatable virtualenv with bundled Python interpreter and other libraries (excluding system ones like glibc).
For more information, check out the Packaging and Relenv docs. Also note the following caveat.
Test suite improvements
The Salt Project made several improvements to the test suite that will speed up the testing process for new PRs, including changes to test decorators and the process for running local tests with Nox. These improvements will allow the core Salt team to selectively choose to run and re-run certain tests based on which tests are applicable to the pull request. These changes will speed up the contributing and pull request review process.
Other changes:
- Stop running tests on Jenkins, with the exception of the cloud tests. PR #63833 by Pedro Algarvio
- Trigger scheduled (nightly) builds on non default branches. PR #63813 by Pedro Algarvio
- And as usual, lots of tests were migrated to pytest.
Native minion packages
With the release of Salt 3006, the Salt Project will no longer build the native minion packages (AIX, Arista, Juniper, Solaris 10, Solaris 11). Instead it is inviting co-maintainers for these GitHub repositories, and for the community to further develop the native minions. For more details see the announcement blog post.
Security
Unprivileged Salt Master user
Salt Master for Linux now runs under the salt
user and group (the packages will add the user: salt
config option to the Salt Master config). For more details and some caveats related to permissions see the official release notes.
PRs #64037 and #64084 by Megan Wilhite
Restricted default salt-api capabilities
All netapi clients, which provide the functionality to salt-api, will now be disabled by default as a security precaution. If you use salt-api, you must add the new netapi_enable_clients
option to your salt master config. This is a breaking change and the salt-api will not function without this new configuration option.
Configuration with all possible clients enabled:
netapi_enable_clients:
- local
- local_async
- local_batch
- local_subset
- runner
- runner_async
- ssh
- wheel
- wheel_async
Enabling all clients is not recommended - only enable the clients that provide the functionality required.
PR #63050 by Barney Sowood
State system
Global state conditions
If we want to check a standard condition in grains, we’d have to template around every state block in which we’d want to perform that check:
{% if grains.get("virtual_subtype") != "chroot" -%}
manage_service:
service.running:
- name: service_name
{% endif -%}
Using the new feature we only need to set a minion configuration option on the host:
global_state_conditions:
service: ["not G@virtual_subtype:chroot"]
…and then a standard state block such as:
manage_service:
service.running:
- name: service_name
…will not be run on a host which doesn’t meet the conditions for the state to be run:
----------
ID: manage_service
Function: service.running
Name: service_name
Result: None
Comment: Failed to meet global state conditions. State not called.
Started: 13:30:47.823249
Duration: 3.012 ms
Changes:
PR #62717 by Nicholas Hughes
Umask
umask
is now a global state argument, instead of only applying to cmd.*
states.
/tmp/file.txt:
file.managed:
- umask: "077"
- contents: |
Hello there!
PR #57803 by Erik Johnson
State queue
The queue=true
parameter to state module functions allows a new state run to be queued and wait for a run already in progress to complete before proceeding. However, there is currently no way to enable it by default and no limit to how many runs will wait in the queue. If state runs are being performed on an interval and the runs take longer than the interval time, the queue could stack up indefinitely until the machine “falls over”.
Now, it is possible to enable queuing for state runs by default via the state_queue
minion configuration option. It can be set to true
or to an integer, which will be checked against the current queue size. If the queue is greater than or equal to the maximum, then that specific run will be treated as if queue=false
and return a conflict.
PR #63357 by Nicholas Hughes
State events
Add state_events
option to state.highstate
, state.apply
, state.sls
, state.sls_id
to enable state events whilst applying states. This allows users to enable state_events
on a per-use basis rather than having to enable them globally in the master config for all state runs.
PR #63316 by Barney Sowood
Event ID lists
Add ability for salt.wait_for_event
orchestration state to handle lists of received event ID values (like the lost
value in presence events):
wait-for-node-death:
salt.wait_for_event:
- name: salt/presence/change
- id_list:
- some_old_node
- timeout: 3000
- event_id: lost
{
"data": {
"new": [],
"lost": [
"some_old_node"
],
"_stamp': '2021-06-23T15:02:04.621354"
},
"tag": "salt/presence/change"
}
PR #60443 by @jwyoungpm
Other state improvements
- Make legacy and modern
module.run
syntax detection work formodule.wait
. PR #63006 by Dheeraj - Ignore extend declarations in sls files that are excluded. PR #62862 by Alexander Graul
- Fix access to
__opts__
and__sls__
vars in pyobjects renderer. PR #62337 by Nicholas Hughes - Always populate
__sls__
,__id__
andname
on state requirements. PR #63012 by Pedro Algarvio - Allow saltcheck to use remote file client functions and render pyobjects states. PR #62726 by Nicholas Hughes
- Make saltcheck pass
saltenv
tostate.show_top
. PR #62655 by Nicholas Hughes - Fix requisites when prerequired state fails. PR #62449 by Gareth J. Greenaway
- Aggregate the requisites first and then aggregate the states. PR #62529 by Gareth J. Greenaway
- Make pass renderer configurable. PR #62120 by Daniel Mach
- Remove and deprecate the
__orchestration__
key fromsalt.runner
andsalt.wheel
return data. To get it back, setfeatures.enable_deprecated_orchestration_flag
master configuration option toTrue
. The flag will be completely removed in Salt 3008 Argon. PR #59917 by Max Arnold
Salt SSH
SSH known_hosts roster
This feature grabs IPs and hostnames from a known_hosts file and generates a roster for salt-ssh
command. To pass other parameters, use roster_defaults
:
# /etc/salt/master.d/ssh.conf
roster: sshknownhosts
ssh_known_hosts_file: /home/joeblade/.ssh/known_hosts
roster_defaults:
user: joeblade
sudo: True
However, the roster targeting would fail horribly if the HashKnownHosts
OpenSSH option is enabled:
% sudo salt-ssh '*' test.ping
|1|PPU19wY2tbgDTC6DJHHBm3lssDs=|YREkx8uqm6ia3kDcbcf+Rgsps5s=:
ssh: Could not resolve hostname |1|ppu19wy2tbgdtc6djhhbm3lssds=|yrekx8uqm6ia3kdcbcf+rgsps5s=: Name or service not known
PRs #51840 by Rémi Jouannet and #54679 by Gareth J. Greenaway
Other SSH improvements
- Sync custom roster modules when
saltutil.sync_all
runner is called. PR #62805 by Gareth J. Greenaway - Make salt-ssh respect
--wipe
again. PR #63037 by jeanluc - Fix
(pillar|grains).filter_by
with salt-ssh. PR #63041 by jeanluc - Explicitly pass context for salt-ssh state calls (should fix
extra_filerefs
). PR #63184 by Megan Wilhite
Grains
- Set
enable_fqdns_grains: false
by default. It looks like enabling this feature by default was a mistake that took a couple of Salt versions to fix (see #55581, #57576, #57676, #60533, #61777, #63204). Implemented in PR #63555 by Gareth J. Greenaway - Disable FQDNs grains on macOS by default. PR #63204 by jeanluc
- Add support for exposing metadata grains for Azure VMs. To enable these grains, set
metadata_server_grains: true
in the minion config. PR #63606 by @guvishal989 - Add
biosvendor
grain. PR #62497 by Nicholas Hughes - Add
boardname
grain. PR #63132 by Nicholas Hughes - Implement support for core grains for Linux ppc64le architecture. PR #60519 by Lukas Raska
- Set
virtual_subtype
toAmazon EC2
in case if it detects the instance running in Amazon EC2 environment. PR #62539 by Victor Zhestkov - Use
platform.freedesktop_os_release
on Python => 3.10 that caches the result of the parsed os-release file. PR #61589 by Benjamin Drung - Add EndeavourOS to the Arch
os_family
. PR #62220 by @droogmic - Add Parrot to the Debian
os_family
. PR #60250 by @unman - Remove
manufacture
grain, which has been renamed tomanufacturer
. PR #62926 by Gareth J. Greenaway - Fix unnecessarily complex GCE metadata grains code to use Google metadata service more effectively. PR #62384 by @jonbenning
Pillar
- Add
__env__
substitution (dynamic saltenvs) toext_pillar.stack
. PR #62578 by @morgana2313 - Allow to securely template Vault policies with pillar values. Allow to template Vault
ext_pillar
paths with pillar values from previously rendered pillars. PR #62674 by jeanluc - Add new optional vault option,
config_location
. This can be eithermaster
orlocal
and defines where vault will look for connection details, either requesting them from the master or using the local config. PR #62906 by Megan Wilhite - Fix vault external pillar module for KV v2. PR #62653 by jeanluc
- Add
connected_devices
feature to netbox pillar module. It contains extra information about devices connected to the minion. PR #62666 by Jamie (Bear) Murphy - Pass context to ext pillar modules to make possible storing and reusing values in the
__context__
dictionary. PR #62898 by Victor Zhestkov - Ensure that pillar rendering doesn’t fail if all secrets aren’t available to each minion. PR #63165 by Caleb Beard
- Make pillar cache pass extra minion data to external pillars. PR #63209 by jeanluc
- Add namespace option to
ext_pillar.http_json
. PR #62883 by Megan Wilhite
Performance
- Fix match function call slowness at scale. PR #62295 by Nicholas Hughes
- Fix serious performance issues with the
file.tidied
module. PR #63238 by Nicholas Hughes - Add an automated performance test to the Salt test suite. PR #63233 by Caleb Beard
Slack Bolt engine
A couple of changes in Salt Slack engine:
- Deprecate the legacy
slack
engine (will be removed in Salt 3008 Argon) - Add a new engine called
slack_bolt
that uses Slack Bolt API - Fix the slack engine when calling runners
PRs #62957, #63095, and #63005 by Gareth J. Greenaway
Proxy
- The Deltaproxy proxy minion now allows the sub proxy initialization in parallel. This will dramatically reduce the startup time. Due to a bug related to this new parallel functionality, the Salt core team advises users to limit the number of sub proxies to 20 to avoid hitting a limit with ThreadPoolExecutor. PR #62897 by Gareth J. Greenaway
- Ensure that all modules, especially any custom proxy modules, are available before attempting to run the init function. PR #63084 by Gareth J. Greenaway
- Handle the situation when a sub proxy minion does not init properly, e.g. an exception happens, and the sub proxy object is not available. PR #63923 by Gareth J. Greenaway
TCP
- Tcp transport support for ipv6-only hosts. PR #62009 by Sergey Kacheev
- Correct TCP transport documentation regarding master-side filtering. PR #63125 by Lukas Raska
- Fix presence events on TCP transport. PR #62827 by @recmanj
Jinja
ifelse
function
The ifelse
function is like a multi-level if-else statement. It was inspired by CFEngine’s ifelse
function, which in turn was inspired by Oracle’s DECODE
function. It must have an odd number of arguments (from 1 to N). The last argument is the default value, like the else
clause in standard programming languages. Every pair of arguments before the last one is evaluated as a pair. If the first one evaluates true, then the second one is returned, as if you had used the first one in a compound match expression. Boolean values can also be used as the first item in a pair, as it will be translated to a match that will always match (”*“) or never match (“SALT_IFELSE_MATCH_NOTHING”) a target system.
This is essentially another way to express the match.filter_by
functionality in a way that’s familiar to CFEngine or Oracle users. Consider using match.filter_by
unless this function fits your workflow.
{{ ifelse('foo*', 'fooval', 'bar*', 'barval', 'defaultval', minion_id='bar03') }}
PR #62509 by Nicholas Hughes
ipwrap
filter
From a string, list, or tuple, returns any IPv6 addresses wrapped in square brackets:
Example:
{{ ['192.0.2.1', 'foo', 'bar', 'fe80::', '2001:db8::1/64'] | ipwrap }}
Returns:
["192.0.2.1", "foo", "bar", "[fe80::]", "[2001:db8::1]/64"]
PR #61933 by Gary T. Giesen
Windows
- A module for working with the Windows Event log system. Implements
win_event.get
,win_event.get_filtered
,win_event.query
,win_event.get_log_names
,win_event.add
,win_event.clear
, andwin_event.count
functions. PR #62423 by Shane Lee - Add the ability to remove a KB from the DISM module. PR #62615 by Shane Lee
- Add support for “Relax minimum password length limits” LGPO policy. PR #63605 by Shane Lee
- Add support for two Domain Controller security policies. PR #62936 by Shane Lee
- Build msi installer package. PR #63366 by Shane Lee
- Support the
--priority
flag when adding sources to Chocolatey. PR #61319 by Justin Phelps - Add the
win_lgpo_reg
state and execution modules, which will allow a registry-based group policy to be set directly in theRegistry.pol
file. PR #62888 by Shane Lee
Other notable changes
- Add the
dig.PTR
function to thedig
execution module. This allows the resolution of PTR records. PR #62314 by M S - Add
file.pruned
state. PR #62179 by Nicholas Hughes - Add
sysfs
state module to manage kernel objects. #60155 by Piter Punk - Support
verify_ssl
inpkg.install
. PR #63990 by @amalaguti and Shane Lee - Add the ability to set GCE node labels via Salt Cloud. PR #62046 by Brandon Kucera
- Rewrite x509 modules using
cryptography
instead ofM2Crypto
, add more key and serialization formats. The changes will become the defaultx509
modules in Salt 3008 Argon, but you can explicitly switch to the new modules before that release by settingfeatures: {x509_v2: true}
in your minion configuration. PRs #63099 and #63365 by jeanluc - Implement
keyvalue
serializer, which can be used for serializing or deserializing any file which defines keys and values separated by a common set of characters, such as environment files, which are in “KEY=value” format. PR #62984 by Nicholas Hughes - Add
ps.status
function to get a list of processes on a minion according to their state. PR #61421 by DERNAT Rémy - Make the default pki directory configurable. PR #61453 by Benjamin Drung
- Remove PhotonOS 3 from Jenkins & Drop Ubuntu 18.04. PR #63728 by Pedro Algarvio
- Remove Debian 9 (EoL). PR #62342 by Kirill Ponomarev
- Initial removal of distutils usage and replacement with setuptools. PR #63309 by David Murphy
- Allow
cron.present
to change a timespec from non-special to special without duplicating entries. PR #60998 by Alan Somers - Add the
age_size_logical_operator
andage_size_only
parameters tofile.tidied
, which allow additional flexibility in specifying age and size conditions which trigger removal of files. PR #62679 by Nicholas Hughes - Add
dir_mode
argument tofile.copy
state (created parent directories by default have the execute bit set). PR #62650 by jeanluc - Adopt the new
pyroute2.NDB
API inbeacons.network_settings
. PR #62218 by Peter Saveliev - Use the
VENV_PIP_TARGET
environment variable as a default target forpip.installed
if present. PR #62089 by Victor Zhestkov - Allow passing CLI arguments to
cassandra_cql
module and provideload_balancing_policy
argument. PR #62493 by Cesar Augusto Sanchez - Add support for
name
,pkgs
anddiff_attr
parameters tozypperpkg.upgrade
andyumpkg.upgrade
. PR #62033 by Alexander Graul - Add VM
autostart
option tovirt.defined
andvirt.running
states, along withvirt.update
execution modules. PR #61735 by Alex - More intelligent diffing in changes of
file.serialize
state. PR #58055 by @anlutro and Gareth J. Greenaway - Add password/account locking/unlocking in
user.present
state on supported operating systems. PR #62857 by Nicholas Hughes - Add missing MariaDB grants to mysql module. PR #61410 by Carsten Brandt
- Update various MongoDB module functions to work with the latest version of pymongo. PR #62832 by Gareth J. Greenaway
- Deprecate Django returner. PR #62644 by Wayne Werner
- Remove deprecated utils/boto3_elasticsearch.py. PR #62922 by Gareth J. Greenaway
- Add
postgres.timeout
option (60s by default) to postgres module for limiting postgres query times. PR #61433 by André Cruz - Deprecate ESXi in core Salt in favor of Salt VMware extensions for 3008 release. PR #63002 by David Murphy
- Add resource tagging functions to
boto_dynamodb
exec module. PR #57500 by @tkwilliams and Erik Johnson - Make
gpg.decrypt
work withuse_passphrase=True
. PR #62977 by @leifliddy - Add
output
(a filename where the exported key data will be written to) andbare
(return the exported key block as a string without the standard comment/res dict) functionality to thegpg.export_key
function. PR #62979 by @leifliddy - Make
gpg.verify
respectgnupghome
argument. PR #63152 by jeanluc - Fix Salt Syndic return events missing
fun_args
. PR #62809 by Morgan Kesler - Add the ability to ignore symlinks in
file.tidied
. PR #63043 by Nicholas Hughes - Allow users to touch a file with Unix date of birth. PR #57222 by @importepeu and @alexey-zhukovin
- Add
disk
module functions to return block device, mount point, and file system type for a path. PR #63104 by Nicholas Hughes - Add the ability for
file.symlink
to not set ownership on existing links. PR #63106 by Nicholas Hughes - Support fractional
keep_jobs
interval times. This is done by renamingkeep_jobs
, specifying job cache TTL in hours, tokeep_jobs_seconds
, specifying TTL in seconds.keep_jobs
will be removed in the 3008 Argon release. PR #55313 by Kevin R - Add ethtool execution and state module functions to apply pause parameters. PR #63129 by Nicholas Hughes
- Add support for NVMeF as a transport protocol for hosts in a Pure Storage FlashArray. PR #56965 by @sdodsley and @alexey-zhukovin
- Add
onchange
flag for the script engine to only fire an event if the event tag-specific data changes compared to the last run. PR #62868 by jeanluc - Allow creating OpenVSwitch bridges that have a parent bridge; updating values in the OpenVSwitch database. PR #58987 by Sebastian Marsching
- Fix return of REST-returned
salt-api
permissions whenauth_list
is set. PR #62680 by Foorack / Max Faxälv - Allow salt-cloud to connect to EC2 IMDSv2 using tokens, while still supporting IMDSv1. PR #63067 by Peter Steffey
- Make syndics honor MoM ACL (this should fix syndic issues introduced in 3005). PR #63428 by Daniel Wozniak
- Fix the ability to set a scheduled task to auto delete if not scheduled to run again (
delete_after
). PR #63976 by Shane Lee - Handle the scenario when the
check_cmd
requisite is used with a state function when the state has a localcheck_cmd
function but that function isn’t used by that function. PR #63970 by Gareth J. Greenaway
You can find other changes and bugfixes in the official CHANGELOG.md and Release Notes
Want to read about the upcoming Argon release?
I’m always hesitant to commit to writing another post like this one (it takes a lot of time!). However, I get bits of motivation to do so when people subscribe to the mailing list.
Powered by Mailgit