neulab/tldr huggingface dataset:
salt.states.winrepo.genrepo(name, force=False, allow_empty=False) Refresh the winrepo.p file of the repository (salt-run winrepo.genrepo)
If force is True no checks will be made and the repository will be generated if allow_empty is True then the state will not return an error if there are 0 packages,
NOTE: This state only loads on minions that have the roles: salt-master grain set.
winrepo: winrepo.genrepo
salt.states.wordpress This state module is used to manage Wordpress installations
salt.states.wordpress.activated(name, path, user) Activate wordpress plugins
name   name of plugin to activate
path   path to wordpress installation
user   user who should own the files in the wordpress installation
HyperDB: wordpress.activated: - path: /var/www/html - user: apache
salt.states.wordpress.deactivated(name, path, user) Deactivate wordpress plugins
name   name of plugin to deactivate
HyperDB: wordpress.deactivated: - path: /var/www/html - user: apache
salt.states.wordpress.installed(name, user, admin_user, admin_password, admin_email, title, url) Run the initial setup of wordpress
name   path to the wordpress installation
user   user that owns the files for the wordpress installation
admin_user username for wordpress website administrator user
admin_password password for wordpress website administrator user
admin_email email for wordpress website administrator user
title  title for the wordpress website
url    url for the wordpress website
/var/www/html: wordpress.installed: - title: Daniel's Awesome Blog - user: apache - admin_user: dwallace - admin_email: dwallace@example.com - admin_password: password123 - url: https://blog.dwallace.com
salt.states.x509 Manage X509 Certificates
This module can enable managing a complete PKI infrastructure including creating private keys, CAs, certificates and CRLs. It includes the ability to generate a private key on a server, and have the corresponding public key sent to a remote CA to create a CA signed certificate. This can be done in a secure manner, where private keys are always generated locally and never moved across the network.
Here is a simple example scenario. In this example ca is the ca server, and www is a web server that needs a certificate signed by ca.
For remote signing, peers must be permitted to remotely call the sign_remote_certificate function.
/srv/salt/top.sls
base: '*': - cert 'ca': - ca 'www': - www
This state creates the CA key, certificate and signing policy. It also publishes the certificate to the mine where it can be easily retrieved by other minions.
/srv/salt/ca.sls
/etc/salt/minion.d/x509.conf: file.managed: - source: salt://x509.conf
restart-salt-minion: cmd.run: - name: 'salt-call service.restart salt-minion' - bg: True - onchanges: - file: /etc/salt/minion.d/x509.conf
/etc/pki: file.directory
/etc/pki/issued_certs: file.directory
/etc/pki/ca.key: x509.private_key_managed: - bits: 4096 - backup: True
/etc/pki/ca.crt: x509.certificate_managed: - signing_private_key: /etc/pki/ca.key - CN: ca.example.com - C: US - ST: Utah - L: Salt Lake City - basicConstraints: "critical CA:true" - keyUsage: "critical cRLSign, keyCertSign" - subjectKeyIdentifier: hash - authorityKeyIdentifier: keyid,issuer:always - days_valid: 3650 - days_remaining: 0 - backup: True - require: - file: /etc/pki
The signing policy defines properties that override any property requested or included in a CRL. It also can define a restricted list of minions which are allowed to remotely invoke this signing policy.
/srv/salt/x509.conf
mine_functions: x509.get_pem_entries: [/etc/pki/ca.crt]
x509_signing_policies: www: - minions: 'www' - signing_private_key: /etc/pki/ca.key - signing_cert: /etc/pki/ca.crt - C: US - ST: Utah - L: Salt Lake City - basicConstraints: "critical CA:false" - keyUsage: "critical keyEncipherment" - subjectKeyIdentifier: hash - authorityKeyIdentifier: keyid,issuer:always - days_valid: 90 - copypath: /etc/pki/issued_certs/
This state will instruct all minions to trust certificates signed by our new CA.  Using Jinja to strip newlines from the text avoids dealing with newlines in the rendered YAML, and the  sign_remote_certificate state will handle properly formatting the text before writing the output.
/srv/salt/cert.sls
/usr/local/share/ca-certificates: file.directory
/usr/local/share/ca-certificates/intca.crt: x509.pem_managed: - text: {{ salt['mine.get']('ca', 'x509.get_pem_entries')['ca']['/etc/pki/ca.crt']|replace('\n', '') }}
This state creates a private key then requests a certificate signed by ca according to the www policy.
/srv/salt/www.sls
/etc/pki/www.crt: x509.private_key_managed: - name: /etc/pki/www.key - bits: 4096 - backup: True
/etc/pki/www.crt: x509.certificate_managed: - ca_server: ca - signing_policy: www - public_key: /etc/pki/www.key - CN: www.example.com - days_remaining: 30 - backup: True
This other state creates a private key then requests a certificate signed by ca according to the www policy but adds a strict date range for the certificate to be considered valid.
/srv/salt/www-time-limited.sls
/etc/pki/www-time-limited.crt: x509.certificate_managed: - ca_server: ca - signing_policy: www - public_key: /etc/pki/www-time-limited.key - CN: www.example.com - not_before: 2019-05-05 00:00:00 - not_after: 2020-05-05 14:30:00 - backup: True
salt.states.x509.certificate_managed(name, days_remaining=90, append_certs=None, **kwargs) Manage a Certificate
name   Path to the certificate
days_remaining 90 Recreate the certificate if the number of days remaining on it are less than this number. The value should be less than days_valid, otherwise the certificate will be recreated every time the state is run. A value of 0 disables automatic renewal.
append_certs: A list of certificates to be appended to the managed file. They must be valid PEM files, otherwise an error will be thrown.
kwargs: Any arguments supported by x509.create_certificate or file.managed are supported.
/etc/pki/ca.crt: x509.certificate_managed: - signing_private_key: /etc/pki/ca.key - CN: ca.example.com - C: US - ST: Utah - L: Salt Lake City - basicConstraints: "critical CA:true" - keyUsage: "critical cRLSign, keyCertSign" - subjectKeyIdentifier: hash - authorityKeyIdentifier: keyid,issuer:always - days_valid: 3650 - days_remaining: 0 - backup: True
/etc/ssl/www.crt: x509.certificate_managed: - ca_server: pki - signing_policy: www - public_key: /etc/ssl/www.key - CN: www.example.com - days_valid: 90 - days_remaining: 30 - backup: True
salt.states.x509.crl_managed(name, signing_private_key, signing_private_key_passphrase=None, signing_cert=None, revoked=None, days_valid=100, digest='', days_remaining=30, include_expired=False, **kwargs) Manage a Certificate Revocation List
signing_private_key The private key that will be used to sign the CRL. This is usually your CA's private key.
signing_private_key_passphrase Passphrase to decrypt the private key.
signing_cert The certificate of the authority that will be used to sign the CRL.  This is usually your CA's certificate.
revoked A list of certificates to revoke. Must include either a serial number or a the certificate itself. Can optionally include the revocation date and notAfter date from the certificate. See example below for details.
days_valid 100 The number of days the certificate should be valid for.
digest The digest to use for signing the CRL. This has no effect on versions of pyOpenSSL less than 0.14.
days_remaining 30 The CRL should be automatically recreated if there are less than days_remaining days until the CRL expires. Set to 0 to disable automatic renewal.
include_expired False If True, include expired certificates in the CRL.
kwargs Any arguments supported by file.managed are supported.
/etc/pki/ca.crl: x509.crl_managed: - signing_private_key: /etc/pki/myca.key - signing_cert: /etc/pki/myca.crt - revoked: - compromized_Web_key: - certificate: /etc/pki/certs/badweb.crt - revocation_date: 2015-03-01 00:00:00 - reason: keyCompromise - terminated_vpn_user: - serial_number: D6:D2:DC:D8:4D:5C:C0:F4 - not_after: 2016-01-01 00:00:00 - revocation_date: 2015-02-25 00:00:00 - reason: cessationOfOperation
salt.states.x509.csr_managed(name, **kwargs) Manage a Certificate Signing Request
name:  Path to the CSR
properties: The properties to be added to the certificate request, including items like subject, extensions and public key. See above for valid properties.
kwargs: Any arguments supported by file.managed are supported.
/etc/pki/mycert.csr: x509.csr_managed: - private_key: /etc/pki/mycert.key - CN: www.example.com - C: US - ST: Utah - L: Salt Lake City - keyUsage: 'critical dataEncipherment'
salt.states.x509.pem_managed(name, text, backup=False, **kwargs) Manage the contents of a PEM file directly with the content in text, ensuring correct formatting.
name:  The path to the file to manage
text:  The PEM formatted text to write.
salt.states.x509.private_key_managed(name, bits=2048, passphrase=None, cipher='aes_128_cbc', new=False, overwrite=False, verbose=True, **kwargs) Manage a private key's existence.
name:  Path to the private key
bits:  Key length in bits. Default 2048.
passphrase: Passphrase for encrypting the private key.
cipher: Cipher for encrypting the private key.
new:   Always create a new key. Defaults to False.  Combining new with prereq can allow key rotation whenever a new certificate is generated.
overwrite: Overwrite an existing private key if the provided passphrase cannot decrypt it.
verbose: Provide visual feedback on stdout, dots while key is generated.  Default is True.
kwargs: Any kwargs supported by file.managed are supported.
The JINJA templating in this example ensures a private key is generated if the file doesn't exist and that a new private key is generated whenever the certificate that uses it is to be renewed.
/etc/pki/www.key: x509.private_key_managed: - bits: 4096 - new: True {% if salt['file.file_exists']('/etc/pki/www.key') -%} - prereq: - x509: /etc/pki/www.crt {%- endif %}
salt.states.xml XML Manager State management of XML files
salt.states.xml.value_present(name, xpath, value, **kwargs) New in version 3000.
Manages a given XML file
name   string The location of the XML file to manage, as an absolute path.
xpath  string xpath location to manage
value  string value to ensure present
ensure_value_true: xml.value_present: - name: /tmp/test.xml - xpath: .//playwright[@id='1'] - value: William Shakespeare
salt.states.xmpp Sending Messages over XMPP New in version 2014.1.0.
This state is useful for firing messages during state runs, using the XMPP protocol
server-warning-message: xmpp.send_msg: - name: 'This is a server warning message' - profile: my-xmpp-account - recipient: admins@xmpp.example.com/salt
salt.states.xmpp.send_msg(name, recipient, profile) Send a message to an XMPP user
name   The message to send to the XMPP user
salt.states.xmpp.send_msg_multi(name, profile, recipients=None, rooms=None) Send a message to an list of recipients or rooms
server-warning-message: xmpp.send_msg: - name: 'This is a server warning message' - profile: my-xmpp-account - recipients: - admins@xmpp.example.com/salt - rooms: - qa@conference.xmpp.example.com
salt.states.zabbix_action New in version 2017.7.
Management of Zabbix Action object over Zabbix API.
codeauthor Jakub Sliva <jakub.sliva@ultimum.io>
salt.states.zabbix_action.absent(name, **kwargs) Makes the Zabbix Action to be absent (either does not exist or delete it).
• name -- Zabbix Action name
zabbix-action-absent: zabbix_action.absent: - name: Action name
salt.states.zabbix_action.present(name, params, **kwargs) Creates Zabbix Action object or if differs update it according defined parameters
• params -- Definition of the Zabbix Action
If there is a need to get a value from current zabbix online (e.g. id of a hostgroup you want to put a discovered system into), put a dictionary with two keys "query_object" and "query_name" instead of the value.  In this example we want to get object id of hostgroup named "Virtual machines" and "Databases".
zabbix-action-present: zabbix_action.present: - name: VMs - params: eventsource: 2 status: 0 filter: evaltype: 2 conditions: - conditiontype: 24 operator: 2 value: 'virtual' - conditiontype: 24 operator: 2 value: 'kvm' operations: - operationtype: 2 - operationtype: 4 opgroup: - groupid: query_object: hostgroup query_name: Virtual machines - groupid: query_object: hostgroup query_name: Databases
salt.states.zabbix_host Management of Zabbix hosts.
salt.states.zabbix_host.absent(name, **kwargs) Ensures that the host does not exists, eventually deletes host.
Param  name: technical name of the host
TestHostWithInterfaces: zabbix_host.absent
salt.states.zabbix_host.assign_templates(host, templates, **kwargs) Ensures that templates are assigned to the host.
add_zabbix_templates_to_host: zabbix_host.assign_templates: - host: TestHost - templates: - "Template OS Linux" - "Template App MySQL"
salt.states.zabbix_host.present(host, groups, interfaces, **kwargs) Ensures that the host exists, eventually creates new host.  NOTE: please use argument visible_name instead of name to not mess with name from salt sls. This function accepts all standard host properties: keyword argument names differ depending on your zabbix version, see: https://www.zabbix.com/documentation/2.4/manual/api/reference/host/object#host
• proxy_host -- Optional proxy name or proxyid to monitor host
• inventory -- Optional list or dictionary of inventory names and values
• visible_name -- Optional - string with visible name of the host, use 'visible_name' instead of 'name' parameter to not mess with value supplied from Salt sls file.
• inventory_clean -- Optional - Boolean value that selects if the current inventory will be cleaned and overwritten by the declared inventory list (True); or if the inventory will be kept and only updated with inventory list contents (False). Defaults to True
create_test_host: zabbix_host.present: - host: TestHostWithInterfaces - proxy_host: 12345 - groups: - 5 - 6 - 7 - interfaces: - test1.example.com: - ip: '192.168.1.8' - type: 'Agent' - port: 92 - testing2_create: - ip: '192.168.1.9' - dns: 'test2.example.com' - type: 'agent' - main: false - testovaci1_ipmi: - ip: '192.168.100.111' - type: 'ipmi' - inventory: - alias: some alias - asset_tag: jlm3937
salt.states.zabbix_hostgroup Management of Zabbix host groups.
salt.states.zabbix_hostgroup.absent(name, **kwargs) Ensures that the host group does not exist, eventually delete host group.
delete_testing_host_group: zabbix_hostgroup.absent: - name: 'My hostgroup name'
salt.states.zabbix_hostgroup.present(name, **kwargs) Ensures that the host group exists, eventually creates new host group.
create_testing_host_group: zabbix_hostgroup.present: - name: 'My hostgroup name'
salt.states.zabbix_mediatype Management of Zabbix mediatypes.
codeauthor Raymond Kuiper <qix@the-wired.net>
salt.states.zabbix_mediatype.absent(name, **kwargs) Ensures that the mediatype does not exist, eventually deletes the mediatype.
• name -- name of the mediatype
delete_mediatype: zabbix_mediatype.absent: - name: 'Email'
salt.states.zabbix_mediatype.present(name, mediatype, **kwargs) Creates new mediatype.  NOTE: This function accepts all standard mediatype properties: keyword argument names differ depending on your zabbix version, see: https://www.zabbix.com/documentation/3.0/manual/api/reference/host/object#host_inventory
make_new_mediatype: zabbix_mediatype.present: - name: 'Email' - mediatype: 0 - smtp_server: smtp.example.com - smtp_hello: zabbix.example.com - smtp_email: zabbix@example.com
salt.states.zabbix_template New in version 2017.7.
Management of Zabbix Template object over Zabbix API.
salt.states.zabbix_template.absent(name, **kwargs) Makes the Zabbix Template to be absent (either does not exist or delete it).
• name -- Zabbix Template name
zabbix-template-absent: zabbix_template.absent: - name: Ceph OSD
salt.states.zabbix_template.is_present(name, **kwargs) Check if Zabbix Template already exists.
does_zabbix-template-exist: zabbix_template.is_present: - name: Template OS Linux
salt.states.zabbix_template.present(name, params, static_host_list=True, **kwargs) Creates Zabbix Template object or if differs update it according defined parameters. See Zabbix API documentation.
Zabbix API version: >3.0
• params -- Additional parameters according to Zabbix API documentation
• static_host_list -- If hosts assigned to the template are controlled only by this state or can be also assigned externally
NOTE: If there is a need to get a value from current zabbix online (e.g. ids of host groups you want the template to be associated with), put a dictionary with two keys "query_object" and "query_name" instead of the value.  In this example we want to create template named "Testing Template", assign it to hostgroup Templates, link it to two ceph nodes and create a macro.
NOTE: IMPORTANT NOTE: Objects (except for template name) are identified by name (or by other key in some exceptional cases) so changing name of object means deleting old one and creating new one with new ID !!!
NOT SUPPORTED FEATURES:
• linked templates
• trigger dependencies
• groups and group prototypes for host prototypes
zabbix-template-present: zabbix_template.present: - name: Testing Template # Do not touch existing assigned hosts # True will detach all other hosts than defined here - static_host_list: False - params: description: Template for Ceph nodes groups: # groups must already exist # template must be at least in one hostgroup - groupid: query_object: hostgroup query_name: Templates macros: - macro: "{$CEPH_CLUSTER_NAME}" value: ceph hosts: # hosts must already exist - hostid: query_object: host query_name: ceph-osd-01 - hostid: query_object: host query_name: ceph-osd-02 # templates: # Linked templates - not supported by state module but can be linked manually (will not be touched)
applications: - name: Ceph OSD items: - name: Ceph OSD avg fill item key_: ceph.osd_avg_fill type: 2 value_type: 0 delay: 60 units: '%' description: 'Average fill of OSD' applications: - applicationid: query_object: application query_name: Ceph OSD triggers: - description: "Ceph OSD filled more that 90%" expression: "{{'{'}}Testing Template:ceph.osd_avg_fill.last(){{'}'}}>90" priority: 4 discoveries: - name: Mounted filesystem discovery key_: vfs.fs.discovery type: 0 delay: 60 itemprototypes: - name: Free disk space on {{'{#'}}FSNAME} key_: vfs.fs.size[{{'{#'}}FSNAME},free] type: 0 value_type: 3 delay: 60 applications: - applicationid: query_object: application query_name: Ceph OSD triggerprototypes: - description: "Free disk space is less than 20% on volume {{'{#'}}FSNAME{{'}'}}" expression: "{{'{'}}Testing Template:vfs.fs.size[{{'{#'}}FSNAME},free].last(){{'}'}}<20" graphs: - name: Ceph OSD avg fill graph width: 900 height: 200 graphtype: 0 gitems: - color: F63100 itemid: query_object: item query_name: Ceph OSD avg fill item screens: - name: Ceph hsize: 1 vsize: 1 screenitems: - x: 0 y: 0 resourcetype: 0 resourceid: query_object: graph query_name: Ceph OSD avg fill graph
salt.states.zabbix_user Management of Zabbix users.
salt.states.zabbix_user.absent(name, **kwargs) Ensures that the user does not exist, eventually delete user.
• name -- user alias
George: zabbix_user.absent
salt.states.zabbix_user.admin_password_present(name, password=None, **kwargs)
Initial change of Zabbix Admin password to password taken from one of the sources (only the most prioritized one):
1. 'password' parameter
2. '_connection_password' parameter
3. pillar 'zabbix.password' setting
1. Tries to log in as Admin with password found in state password parameter or _connection_password or pillar or default zabbix password in this precise order, if any of them is present.
2. If one of above passwords matches, it tries to change the password to the most prioritized one.
3. If not able to connect with any password then it fails.
• name -- Just a name of state
• password -- Optional - desired password for Admin to be set
• _connection_user -- Optional - Ignored in this state (always assumed 'Admin')
# password taken from pillar or _connection_password zabbix-admin-password: zabbix_user.admin_password_present
# directly set password zabbix-admin-password: zabbix_user.admin_password_present: - password: SECRET_PASS
salt.states.zabbix_user.present(alias, passwd, usrgrps, medias=None, password_reset=False, **kwargs) Ensures that the user exists, eventually creates new user.  NOTE: use argument firstname instead of name to not mess values with name from salt sls.
• medias -- Optional - user's medias to create
• password_reset -- whether or not to reset password at update
make_user: zabbix_user.present: - alias: George - passwd: donottellanyonE@456x - password_reset: True - usrgrps: - 13 - 7 - medias: - me@example.com: - mediatype: mail - period: '1-7,00:00-24:00' - severity: NIWAHD - make_jabber: - active: true - mediatype: jabber - period: '1-5,08:00-19:00' - sendto: jabbera@example.com - text_me_morning_disabled: - active: false - mediatype: sms - period: '1-5,09:30-10:00' - severity: D - sendto: '+42032132588568'
salt.states.zabbix_usergroup Management of Zabbix user groups.
salt.states.zabbix_usergroup.absent(name, **kwargs) Ensures that the user group does not exist, eventually delete user group.
delete_thai_monks_usrgrp: zabbix_usergroup.absent: - name: 'Thai monks'
salt.states.zabbix_usergroup.present(name, **kwargs) Creates new user group.  NOTE: This function accepts all standard user group properties: keyword argument names differ depending on your zabbix version, see: https://www.zabbix.com/documentation/2.0/manual/appendix/api/usergroup/definitions#user_group
make_new_thai_monks_usergroup: zabbix_usergroup.present: - name: 'Thai monks' - gui_access: 1 - debug_mode: 0 - users_status: 0
salt.states.zabbix_usermacro Management of Zabbix usermacros.  :codeauthor: Raymond Kuiper <‐ qix@the-wired.net>
salt.states.zabbix_usermacro.absent(name, hostid=None, **kwargs) Ensures that the mediatype does not exist, eventually deletes the mediatype.
• name -- name of the usermacro
• hostid -- id's of the hosts to apply the usermacro on, if missing a global usermacro is assumed.
delete_usermacro: zabbix_usermacro.absent: - name: '{$SNMP_COMMUNITY}'
salt.states.zabbix_usermacro.present(name, value, hostid=None, **kwargs) Creates a new usermacro.
• value -- value of the usermacro
override host usermacro: zabbix_usermacro.present: - name: '{$SNMP_COMMUNITY}'' - value: 'public' - hostid: 21
salt.states.zabbix_valuemap New in version 2017.7.
Management of Zabbix Valuemap object over Zabbix API.
salt.states.zabbix_valuemap.absent(name, **kwargs) Makes the Zabbix Value map to be absent (either does not exist or delete it).
• name -- Zabbix Value map name
zabbix-valuemap-absent: zabbix_valuemap.absent: - name: Value map name
salt.states.zabbix_valuemap.present(name, params, **kwargs) Creates Zabbix Value map object or if differs update it according defined parameters
• params -- Definition of the Zabbix Value map
zabbix-valuemap-present: zabbix_valuemap.present: - name: Number mapping - params: mappings: - value: 1 newvalue: one - value: 2 newvalue: two
salt.states.zcbuildout Management of zc.buildout This module is inspired from minitage's buildout maker (‐ https://github.com/minitage/minitage/blob/master/src/minitage/core/makers/buildout.py)
NOTE: This state module is beta; the API is subject to change and no promise as to performance or functionality is yet present
Available Functions • built
installed1 buildout.installed: - name: /path/to/buildout
installed2 buildout.installed: - name: /path/to/buildout - parts: - a - b - python: /path/to/pythonpath/bin/python - unless: /bin/test_something_installed - onlyif: /bin/test_else_installed
salt.states.zcbuildout.installed(name, config='buildout.cfg', quiet=False, parts=None, user=None, env=(), buildout_ver=None, test_release=False, distribute=None, new_st=None, offline=False, newest=False, python='/home/dscripter/git/saltopen/salt/.nox/docs-man-compress-false-update-true-clean-true/bin/python', debug=False, verbose=False, unless=None, onlyif=None, use_vt=False, loglevel='debug', **kwargs) Install buildout in a specific directory
It is a thin wrapper to modules.buildout.buildout
name   directory to execute in
quiet do not output console & logs
config buildout config to use (default: buildout.cfg)
user   user used to run buildout as
loglevel loglevel for buildout commands
salt.states.zenoss State to manage monitoring in Zenoss.
This state module depends on the 'zenoss' Salt execution module.
Allows for setting a state of minions in Zenoss using the Zenoss API. Currently Zenoss 4.x and 5.x are supported.
enable_monitoring: zenoss.monitored: - name: web01.example.com - device_class: /Servers/Linux - collector: localhost - prod_state: 1000
salt.states.zenoss.monitored(name, device_class=None, collector='localhost', prod_state=None) Ensure a device is monitored. The 'name' given will be used for Zenoss device name and should be resolvable.
salt.states.zfs States for managing zfs datasets
depends salt.utils.zfs, salt.modules.zfs
platform smartos, illumos, solaris, freebsd, linux
test/shares/yuki: zfs.filesystem_present: - create_parent: true - properties: quota: 16G
test/iscsi/haruhi: zfs.volume_present: - create_parent: true - volume_size: 16M - sparse: true - properties: readonly: on
test/shares/yuki@frozen: zfs.snapshot_present
moka_origin: zfs.hold_present: - snapshot: test/shares/yuki@frozen
test/shares/moka: zfs.filesystem_present: - cloned_from: test/shares/yuki@frozen
test/shares/moka@tsukune: zfs.snapshot_absent
salt.states.zfs.bookmark_absent(name, force=False, recursive=False) ensure bookmark is absent on the system
force  boolean try harder to destroy the dataset (zfs destroy -f)
recursive boolean also destroy all the child datasets (zfs destroy -r)
salt.states.zfs.bookmark_present(name, snapshot) ensure bookmark exists
name   string name of bookmark
salt.states.zfs.filesystem_absent(name, force=False, recursive=False) ensure filesystem is absent on the system
WARNING: If a volume with name exists, this state will succeed without destroying the volume specified by name. This module is dataset type sensitive.
salt.states.zfs.filesystem_present(name, create_parent=False, properties=None, cloned_from=None) ensure filesystem exists and has properties set
create_parent boolean creates all the non-existing parent datasets.  any property specified on the command line using the -o option is ignored.
cloned_from string name of snapshot to clone
NOTE: cloned_from is only use if the filesystem does not exist yet, when cloned_from is set after the filesystem exists it will be ignored.
NOTE: Properties do not get cloned, if you specify the properties in the state file they will be applied on a subsequent run.
salt.states.zfs.hold_absent(name, snapshot, recursive=False) ensure hold is absent on the system
name   string name of hold
salt.states.zfs.hold_present(name, snapshot, recursive=False) ensure hold is present on the system
name   string name of holdt
recursive boolean recursively add hold with the given tag on the snapshots of all descendent file systems.
salt.states.zfs.promoted(name) ensure a dataset is not a clone
name   string name of fileset or volume
WARNING: only one dataset can be the origin, if you promote a clone the original will now point to the promoted dataset
salt.states.zfs.scheduled_snapshot(name, prefix, recursive=True, schedule=None) maintain a set of snapshots based on a schedule
name   string name of filesystem or volume
prefix string prefix for the snapshots e.g. 'test' will result in snapshots being named 'test-yyyymmdd_hhmm'
recursive boolean create snapshots for all children also
schedule dict dict holding the schedule, the following keys are available (minute, hour, day, month, and year) by default all are set to 0 the value indicated the number of snapshots of that type to keep around.
WARNING: snapshots will only be created and pruned every time the state runs.  a schedule must be setup to automatically run the state. this means that if you run the state daily the hourly snapshot will only be made once per day!
Changed in version 2018.3.0: switched to localtime from gmtime so times now take into account timezones.
salt.states.zfs.snapshot_absent(name, force=False, recursive=False) ensure snapshot is absent on the system
salt.states.zfs.snapshot_present(name, recursive=False, properties=None) ensure snapshot exists and has properties set
recursive boolean recursively create snapshots of all descendent datasets
salt.states.zfs.volume_absent(name, force=False, recursive=False) ensure volume is absent on the system
WARNING: If a filesystem with name exists, this state will succeed without destroying the filesystem specified by name. This module is dataset type sensitive.
salt.states.zfs.volume_present(name, volume_size, sparse=False, create_parent=False, properties=None, cloned_from=None) ensure volume exists and has properties set
volume_size string size of volume
NOTE: cloned_from is only use if the volume does not exist yet, when cloned_from is set after the volume exists it will be ignored.
volume_size is considered a property, so the volume's size will be corrected when the properties get updated if it differs from the original volume.
The sparse parameter is ignored when using cloned_from.
salt.states.zk_concurrency Control concurrency of steps within state execution using zookeeper depends kazoo
This module allows you to "wrap" a state's execution with concurrency control.  This is useful to protect against all hosts executing highstate simultaneously if your services don't all HUP restart. The common way of protecting against this is to run in batch mode, but that doesn't protect from another person running the same batch command (and thereby having 2x the number of nodes deploying at once).
This module will bock while acquiring a slot, meaning that however the command gets called it will coordinate with zookeeper to ensure that no more than max_concurrency steps are executing with a single path.
acquire_lock: zk_concurrency.lock: - name: /trafficeserver - zk_hosts: 'zookeeper:2181' - max_concurrency: 4 - prereq: - service: trafficserver
trafficserver: service.running: - watch: - file: /etc/trafficserver/records.config
/etc/trafficserver/records.config: file.managed: - source: salt://records.config
release_lock: zk_concurrency.unlock: - name: /trafficserver - require: - service: trafficserver
This example would allow the file state to change, but would limit the concurrency of the trafficserver service restart to 4.
salt.states.zk_concurrency.lock(name, zk_hosts=None, identifier=None, max_concurrency=1, timeout=None, ephemeral_lease=False, profile=None, scheme=None, username=None, password=None, default_acl=None) Block state execution until you are able to get the lock (or hit the timeout)
salt.states.zk_concurrency.min_party(name, zk_hosts, min_nodes, blocking=False, profile=None, scheme=None, username=None, password=None, default_acl=None) Ensure that there are min_nodes in the party at name, optionally blocking if not available.
salt.states.zk_concurrency.unlock(name, zk_hosts=None, identifier=None, max_concurrency=1, ephemeral_lease=False, profile=None, scheme=None, username=None, password=None, default_acl=None) Remove lease from semaphore.
salt.states.zone Management of Solaris Zones
depends salt.modules.zoneadm, salt.modules.zonecfg
platform solaris
Below are some examples of how to use this state.  Lets start with creating a zone and installing it.
omipkg1_configuration: zone.present: - name: omipkg1 - brand: ipkg - zonepath: /zones/omipkg1 - properties: - autoboot: true - ip-type: exclusive - cpu-shares: 50 - resources: - attr: - name: owner - value: Jorge Schrauwen - type: string - attr: - name: description - value: OmniOS ipkg zone for testing - type: string - capped-memory: - physical: 64M omipkg1_installation: zone.installed: - name: omipkg1 - require: - zone: omipkg1_configuration omipkg1_running: zone.booted: - name: omipkg1 - require: - zone: omipkg1_installation
A zone without network access is not very useful. We could update the zone.present state in the example above to add a network interface or we could use a separate state for this.
omipkg1_network: zone.resource_present: - name: omipkg1 - resource_type: net - resource_selector_property: mac-addr - resource_selector_value: "02:08:20:a2:a3:10" - physical: znic1 - require: - zone: omipkg1_configuration
Since this is a single tenant system having the owner attribute is pointless.  Let's remove that attribute.
NOTE: The following state run the omipkg1_configuration state will add it again!  If the entire configuration is managed it would be better to add resource_prune and optionally the resource_selector_property properties to the resource.
omipkg1_strip_owner: zone.resource_present: - name: omipkg1 - resource_type: attr - resource_selector_property: name - resource_selector_value: owner - require: - zone: omipkg1_configuration
Let's bump the zone's CPU shares a bit.
NOTE: The following state run the omipkg1_configuration state will set it to 50 again.  Update the entire zone configuration is managed you should update it there instead.
omipkg1_more_cpu: zone.property_present: - name: omipkg1 - property: cpu-shares - value: 100
Or we can remove the limit altogether!
NOTE: The following state run the omipkg1_configuration state will set it to 50 again.  Update the entire zone configuration is managed you should set the property to None (nothing after the :) instead.
omipkg1_no_cpu: zone.property_absent: - name: omipkg1 - property: cpu-shares
salt.states.zone.absent(name, uninstall=False) Ensure a zone is absent
name   string name of the zone
uninstall boolean when true, uninstall instead of detaching the zone first.
salt.states.zone.attached(name, force=False) Ensure zone is attached
force  boolean force attach the zone
salt.states.zone.booted(name, single=False) Ensure zone is booted
single boolean boot in single usermode
salt.states.zone.detached(name) Ensure zone is detached
salt.states.zone.export(name, path, replace=False) Export a zones configuration
path   string path of file to export too.
replace boolean replace the file if it exists
salt.states.zone.halted(name, graceful=True) Ensure zone is halted
graceful boolean use shutdown instead of halt if true
salt.states.zone.import_(name, path, mode='import', nodataset=False, brand_opts=None) Import a zones configuration
path   string path of the configuration file to import
mode   string either import, install, or attach
brand_opts boolean brand specific options to pass
NOTE: The mode argument can be set to import, install, or attach. import: will only import the configuration install: will import and then try to install the zone attach: will import and then try to attach of the zone
omipkg1: zone.import: - path: /foo/bar/baz
salt.states.zone.installed(name, nodataset=False, brand_opts=None) Ensure zone is installed
salt.states.zone.present(name, brand, zonepath, properties=None, resources=None) Ensure a zone with certain properties and resources
brand  string brand of the zone
zonepath string path of the zone
properties list of key-value pairs dict of properties
resources list of key-value pairs dict of resources
NOTE: If the zone does not exist it will not be installed.  You can use the `zone.installed` state for this.
Default resource selectors:
• fs: dir
• net: mac-addr
• device: match
• rctl: name
• attr: name
• dataset: name
• admin: user
WARNING: Properties and resource will not be removed when they are absent from the state!
For properties, simple set them to `None`.
For resources, add the `resource_prune` property and set it to `True`. Also specify the `resource_selector_property` if the default is not the one you want.
salt.states.zone.property_absent(name, property) Ensure property is absent
property string name of property
NOTE: This does a zoneacfg clear call. So the property may be reset to a default value!  Does has the side effect of always having to be called.
salt.states.zone.property_present(name, property, value) Ensure property has a certain value
salt.states.zone.resource_absent(name, resource_type, resource_selector_property, resource_selector_value) Ensure resource is absent
resource_selector_property string unique resource identifier
resource_selector_value string value for resource selection
WARNING: Both resource_selector_property and resource_selector_value must be provided, some properties like `name` are already reserved by salt in there states.
NOTE: You can set both resource_selector_property and resource_selector_value to None for resources that do not require them.
salt.states.zone.resource_present(name, resource_type, resource_selector_property, resource_selector_value, **kwargs) Ensure resource exists with provided properties
WARNING: Both resource_selector_property and resource_selector_value must be provided, some properties like name are already reserved by salt in states.
salt.states.zone.uninstalled(name) Ensure zone is uninstalled
salt.states.zookeeper depends kazoo
ACLS For more information about acls, please checkout the kazoo documentation.
http://kazoo.readthedocs.io/en/latest/api/security.html#kazoo.security.make_digest_acl
The following options can be included in the acl dictionary:
param username Username to use for the ACL.
param password A plain-text password to hash.
param write Write permission.
type write bool
param create Create permission.
type create bool
param delete Delete permission.
type delete bool
param admin Admin permission.
type admin bool
param all All permissions.
type all bool
salt.states.zookeeper.absent(name, version=- 1, recursive=False, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None) Make sure znode is absent
name   path to znode
version Specify the version which should be deleted Default: -1 (always match)
recursive Boolean to indicate if children should be recursively deleted Default: False
delete znode: zookeeper.absent: - name: /test - recursive: True
salt.states.zookeeper.acls(name, acls, version=- 1, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None) Update acls on a znode
acls   list of acl dictionaries to set on znode
update acls: zookeeper.acls: - name: /test/name - acls: - username: daniel password: test all: True - username: gtmanfred password: test all: True
salt.states.zookeeper.present(name, value, acls=None, ephemeral=False, sequence=False, makepath=False, version=- 1, profile=None, hosts=None, scheme=None, username=None, password=None, default_acl=None) Make sure znode is present in the correct state with the correct acls
value  value znode should be set to
acls   list of acl dictionaries to set on znode (make sure the ones salt is connected with are included) Default: None
ephemeral Boolean to indicate if ephemeral znode should be created Default: False
sequence Boolean to indicate if znode path is suffixed with a unique index Default: False
makepath Boolean to indicate if the parent paths should be created Default: False
version For updating, specify the version which should be updated Default: -1 (always match)
add znode: zookeeper.present: - name: /test/name - value: gtmanfred - makepath: True
update znode: zookeeper.present: - name: /test/name - value: daniel - acls: - username: daniel password: test read: true - username: gtmanfred password: test read: true write: true create: true delete: true admin: true - makepath: True
salt.states.zpool States for managing zpools
depends salt.utils.zfs, salt.modules.zpool
oldpool: zpool.absent: - export: true
newpool: zpool.present: - config: import: false force: true - properties: comment: salty storage pool - layout: - mirror: - /dev/disk0 - /dev/disk1 - mirror: - /dev/disk2 - /dev/disk3
partitionpool: zpool.present: - config: import: false force: true - properties: comment: disk partition salty storage pool ashift: '12' feature@lz4_compress: enabled - filesystem_properties: compression: lz4 atime: on relatime: on - layout: - /dev/disk/by-uuid/3e43ce94-77af-4f52-a91b-6cdbb0b0f41b
simplepool: zpool.present: - config: import: false force: true - properties: comment: another salty storage pool - layout: - /dev/disk0 - /dev/disk1
WARNING: The layout will never be updated, it will only be used at time of creation.  It's a whole lot of work to figure out if a devices needs to be detached, removed, etc. This is best done by the sysadmin on a case per case basis.
Filesystem properties are also not updated, this should be managed by the zfs state module.
salt.states.zpool.absent(name, export=False, force=False) ensure storage pool is absent on the system
name   string name of storage pool
export boolean export instead of destroy the zpool if present
force  boolean force destroy or export
salt.states.zpool.present(name, properties=None, filesystem_properties=None, layout=None, config=None) ensure storage pool is present on the system
properties dict optional set of properties to set for the storage pool
filesystem_properties dict optional set of filesystem properties to set for the storage pool (creation only)
layout: dict disk layout to use if the pool does not exist (creation only)
config dict fine grain control over this state
• import (true) - try to import the pool before creating it if absent
• import_dirs (None) - specify additional locations to scan for devices on import (comma-separated)
• device_dir (None, SunOS=/dev/dsk, Linux=/dev) - specify device directory to prepend for none absolute device paths
• force (false) - try to force the import or creation
NOTE: It is no longer needed to give a unique name to each top-level vdev, the old layout format is still supported but no longer recommended.
- mirror: - /tmp/vdisk3 - /tmp/vdisk2 - mirror: - /tmp/vdisk0 - /tmp/vdisk1
The above yaml will always result in the following zpool create:
zpool create mypool mirror /tmp/vdisk3 /tmp/vdisk2 mirror /tmp/vdisk0 /tmp/vdisk1
WARNING: The legacy format is also still supported but not recommended, because ID's inside the layout dict must be unique they need to have a suffix.
mirror-0: /tmp/vdisk3 /tmp/vdisk2 mirror-1: /tmp/vdisk0 /tmp/vdisk1
WARNING: Pay attention to the order of your dict!
- mirror: - /tmp/vdisk0 - /tmp/vdisk1 - /tmp/vdisk2
The above will result in the following zpool create:
zpool create mypool mirror /tmp/vdisk0 /tmp/vdisk1 /tmp/vdisk2
Creating a 3-way mirror! While you probably expect it to be mirror root vdev with 2 devices + a root vdev of 1 device!
thorium modules ┌───────┬─────────────────────────────┐ │calc   │ Used to manage the thorium  │ │       │ register.                   │ ├───────┼─────────────────────────────┤ │check  │ The check Thorium state is  │ │       │ used to create gateways to  │ │       │ commands, the checks make   │ │       │ it easy to make states that │ │       │ watch registers for changes │ │       │ and then just succeed or    │ │       │ fail based on the state of  │ │       │ the register, this creates  │ │       │ the pattern of having a     │ │       │ command execution get gated │ │       │ by a check state via a      │ │       │ requisite.                  │ ├───────┼─────────────────────────────┤ │file   │ Writes matches to disk to   │ │       │ verify activity, helpful    │ │       │ when testing                │ ├───────┼─────────────────────────────┤ │key    │ The key Thorium State is    │ │       │ used to apply changes to    │ │       │ the                         │ │       │ accepted/rejected/pending   │ │       │ keys                        │ ├───────┼─────────────────────────────┤ │local  │ Run remote execution        │ │       │ commands via the local      │ │       │ client                      │ ├───────┼─────────────────────────────┤ │reg    │ Used to manage the thorium  │ │       │ register.                   │ ├───────┼─────────────────────────────┤ │runner │ React by calling            │ │       │ asynchronous runners        │ ├───────┼─────────────────────────────┤ │status │ This thorium state is used  │ │       │ to track the status beacon  │ │       │ events and keep track of    │ │       │ the active status of        │ │       │ minions                     │ ├───────┼─────────────────────────────┤ │timer  │ Allow for flow based        │ │       │ timers.                     │ ├───────┼─────────────────────────────┤ │wheel  │ React by calling            │ │       │ asynchronous runners        │ └───────┴─────────────────────────────┘
salt.thorium.calc Used to manage the thorium register. The thorium register is where compound values are stored and computed, such as averages etc.
depends statistics PyPi module
salt.thorium.calc.add(name, num, minimum=0, maximum=0, ref=None) Adds together the num most recent values. Requires a list.
USAGE:
foo: calc.add: - name: myregentry - num: 5
salt.thorium.calc.calc(name, num, oper, minimum=0, maximum=0, ref=None) Perform a calculation on the num most recent values. Requires a list.  Valid values for oper are:
• add: Add last num values together
• mul: Multiple last num values together
• mean: Calculate mean of last num values
• median: Calculate median of last num values
• median_low: Calculate low median of last num values
• median_high: Calculate high median of last num values
• median_grouped: Calculate grouped median of last num values
• mode: Calculate mode of last num values
foo: calc.calc: - name: myregentry - num: 5 - oper: mean
salt.thorium.calc.mean(name, num, minimum=0, maximum=0, ref=None) Calculates the mean of the num most recent values. Requires a list.
foo: calc.mean: - name: myregentry - num: 5
salt.thorium.calc.median(name, num, minimum=0, maximum=0, ref=None) Calculates the mean of the num most recent values. Requires a list.
foo: calc.median: - name: myregentry - num: 5
salt.thorium.calc.median_grouped(name, num, minimum=0, maximum=0, ref=None) Calculates the grouped mean of the num most recent values. Requires a list.
foo: calc.median_grouped: - name: myregentry - num: 5
salt.thorium.calc.median_high(name, num, minimum=0, maximum=0, ref=None) Calculates the high mean of the num most recent values. Requires a list.
foo: calc.median_high: - name: myregentry - num: 5
salt.thorium.calc.median_low(name, num, minimum=0, maximum=0, ref=None) Calculates the low mean of the num most recent values. Requires a list.
foo: calc.median_low: - name: myregentry - num: 5
salt.thorium.calc.mode(name, num, minimum=0, maximum=0, ref=None) Calculates the mode of the num most recent values. Requires a list.
foo: calc.mode: - name: myregentry - num: 5
salt.thorium.calc.mul(name, num, minimum=0, maximum=0, ref=None) Multiplies together the num most recent values. Requires a list.
foo: calc.mul: - name: myregentry - num: 5
salt.thorium.check The check Thorium state is used to create gateways to commands, the checks make it easy to make states that watch registers for changes and then just succeed or fail based on the state of the register, this creates the pattern of having a command execution get gated by a check state via a requisite.
salt.thorium.check.contains(name, value, count_lt=None, count_lte=None, count_eq=None, count_gte=None, count_gt=None, count_ne=None) Only succeed if the value in the given register location contains the given value
foo: check.contains: - value: itni
run_remote_ex: local.cmd: - tgt: '*' - func: test.ping - require: - check: foo
salt.thorium.check.eq(name, value) Only succeed if the value in the given register location is equal to the given value
foo: check.eq: - value: 42
salt.thorium.check.event(name) Chekcs for a specific event match and returns result True if the match happens
run_remote_ex: local.cmd: - tgt: '*' - func: test.ping - require: - check: salt/foo/*/bar
salt.thorium.check.gt(name, value) Only succeed if the value in the given register location is greater than the given value
foo: check.gt: - value: 42
salt.thorium.check.gte(name, value) Only succeed if the value in the given register location is greater or equal than the given value
foo: check.gte: - value: 42
salt.thorium.check.len_eq(name, value) Only succeed if the length of the given register location is equal to the given value.
foo: check.len_eq: - value: 42
salt.thorium.check.len_gt(name, value) Only succeed if length of the given register location is greater than the given value.
foo: check.len_gt: - value: 42
salt.thorium.check.len_gte(name, value) Only succeed if the length of the given register location is greater or equal than the given value
foo: check.len_gte: - value: 42
salt.thorium.check.len_lt(name, value) Only succeed if the length of the given register location is less than the given value.
foo: check.len_lt: - value: 42
salt.thorium.check.len_lte(name, value) Only succeed if the length of the given register location is less than or equal the given value
foo: check.len_lte: - value: 42