neulab/tldr huggingface dataset:
salt.modules.config.merge(value, default='', omit_opts=False, omit_master=False, omit_pillar=False) Retrieves an option based on key, merging all matches.
Same as option() except that it merges all matches, rather than taking the first match.
salt '*' config.merge schedule
salt.modules.config.option(value, default=None, omit_opts=False, omit_grains=False, omit_pillar=False, omit_master=False, omit_all=False, wildcard=False) Returns the setting for the specified config value. The priority for matches is the same as in config.get, only this function does not recurse into nested data structures. Another difference between this function and config.get is that it comes with a set of "sane defaults".  To view these, you can run the following command:
salt '*' config.option '*' omit_all=True wildcard=True
default The default value if no match is found. If not specified, then the fallback default will be an empty string, unless wildcard=True, in which case the return will be an empty dictionary.
omit_opts False Pass as True to exclude matches from the minion configuration file
omit_grains False Pass as True to exclude matches from the grains
omit_pillar False Pass as True to exclude matches from the pillar data
omit_master False Pass as True to exclude matches from the master configuration file
omit_all True Shorthand to omit all of the above and return matches only from the "sane defaults".
wildcard False If used, this will perform pattern matching on keys. Note that this will also significantly change the return data. Instead of only a value being returned, a dictionary mapping the matched keys to their values is returned. For example, using wildcard=True with a key of 'foo.ba* could return a dictionary like so:
{'foo.bar': True, 'foo.baz': False}
salt '*' config.option redis.host
salt.modules.config.valid_fileproto(uri) Returns a boolean value based on whether or not the URI passed has a valid remote file protocol designation
salt '*' config.valid_fileproto salt://path/to/file
salt.modules.consul Interact with Consul
https://www.consul.io
salt.modules.consul.acl_clone(consul_url=None, token=None, **kwargs) Information about an ACL token.
• consul_url -- The Consul server URL.
• id -- Unique identifier for the ACL to update.
Returns Boolean, message of success or failure, and new ID of cloned ACL.
salt '*' consul.acl_info id='c1c4d223-91cb-3d1f-1ee8-f2af9e7b6716'
salt.modules.consul.acl_create(consul_url=None, token=None, **kwargs) Create a new ACL token.
• name -- Meaningful indicator of the ACL's purpose.
• type -- Type is either client or management. A management token is comparable to a root user and has the ability to perform any action including creating, modifying, and deleting ACLs.
• rules -- The Consul server URL.
Returns Boolean & message of success or failure.
salt '*' consul.acl_create
salt.modules.consul.acl_delete(consul_url=None, token=None, **kwargs) Delete an ACL token.
salt '*' consul.acl_delete id='c1c4d223-91cb-3d1f-1ee8-f2af9e7b6716'
salt.modules.consul.acl_info(consul_url=None, **kwargs) Information about an ACL token.
Returns Information about the ACL requested.
salt.modules.consul.acl_list(consul_url=None, token=None, **kwargs) List the ACL tokens.
Parameters consul_url -- The Consul server URL.
Returns List of ACLs
salt '*' consul.acl_list
salt.modules.consul.acl_update(consul_url=None, token=None, **kwargs) Update an ACL token.
salt '*' consul.acl_update
salt.modules.consul.agent_check_deregister(consul_url=None, token=None, checkid=None) The agent will take care of deregistering the check from the Catalog.
• checkid -- The ID of the check to deregister from Consul.
Returns Boolean and message indicating success or failure.
salt '*' consul.agent_check_deregister checkid='Memory Utilization'
salt.modules.consul.agent_check_fail(consul_url=None, token=None, checkid=None, **kwargs) This endpoint is used with a check that is of the TTL type. When this is called, the status of the check is set to critical and the TTL clock is reset.
• note -- A human-readable message with the status of the check.
salt '*' consul.agent_check_fail checkid='redis_check1' note='Forcing check into critical state.'
salt.modules.consul.agent_check_pass(consul_url=None, token=None, checkid=None, **kwargs) This endpoint is used with a check that is of the TTL type. When this is called, the status of the check is set to passing and the TTL clock is reset.
• checkid -- The ID of the check to mark as passing.
salt '*' consul.agent_check_pass checkid='redis_check1' note='Forcing check into passing state.'
salt.modules.consul.agent_check_register(consul_url=None, token=None, **kwargs) The register endpoint is used to add a new check to the local agent.
• name -- The description of what the check is for.
• id -- The unique name to use for the check, if not provided 'name' is used.
• notes -- Human readable description of the check.
• script -- If script is provided, the check type is a script, and Consul will evaluate that script based on the interval parameter.
• http -- Check will perform an HTTP GET request against the value of HTTP (expected to be a URL) based on the interval parameter.
• ttl -- If a TTL type is used, then the TTL update endpoint must be used periodically to update the state of the check.
• interval -- Interval at which the check should run.
salt '*' consul.agent_check_register name='Memory Utilization' script='/usr/local/bin/check_mem.py' interval='15s'
salt.modules.consul.agent_check_warn(consul_url=None, token=None, checkid=None, **kwargs) This endpoint is used with a check that is of the TTL type. When this is called, the status of the check is set to warning and the TTL clock is reset.
salt '*' consul.agent_check_warn checkid='redis_check1' note='Forcing check into warning state.'
salt.modules.consul.agent_checks(consul_url=None, token=None) Returns the checks the local agent is managing
Returns Returns the checks the local agent is managing
salt '*' consul.agent_checks
salt.modules.consul.agent_join(consul_url=None, token=None, address=None, **kwargs) Triggers the local agent to join a node
• address -- The address for the agent to connect to.
• wan -- Causes the agent to attempt to join using the WAN pool.
salt '*' consul.agent_join address='192.168.1.1'
salt.modules.consul.agent_leave(consul_url=None, token=None, node=None) Used to instruct the agent to force a node into the left state.
• node -- The node the agent will force into left state
salt '*' consul.agent_leave node='web1.example.com'
salt.modules.consul.agent_maintenance(consul_url=None, token=None, **kwargs) Manages node maintenance mode
• enable -- The enable flag is required.  Acceptable values are either true (to enter maintenance mode) or false (to resume normal operation).
• reason -- If provided, its value should be a text string explaining the reason for placing the node into maintenance mode.
salt '*' consul.agent_maintenance enable='False' reason='Upgrade in progress'
salt.modules.consul.agent_members(consul_url=None, token=None, **kwargs) Returns the members as seen by the local serf agent
Returns Returns the members as seen by the local serf agent
salt '*' consul.agent_members
salt.modules.consul.agent_self(consul_url=None, token=None) Returns the local node configuration
Returns Returns the local node configuration
salt '*' consul.agent_self
salt.modules.consul.agent_service_deregister(consul_url=None, token=None, serviceid=None) Used to remove a service.
• serviceid -- A serviceid describing the service.
salt '*' consul.agent_service_deregister serviceid='redis'
salt.modules.consul.agent_service_maintenance(consul_url=None, token=None, serviceid=None, **kwargs) Used to place a service into maintenance mode.
• serviceid -- A name of the service.
• enable -- Whether the service should be enabled or disabled.
• reason -- A human readable message of why the service was enabled or disabled.
salt '*' consul.agent_service_deregister serviceid='redis' enable='True' reason='Down for upgrade'
salt.modules.consul.agent_service_register(consul_url=None, token=None, **kwargs) The used to add a new service, with an optional health check, to the local agent.
• name -- A name describing the service.
• address -- The address used by the service, defaults to the address of the agent.
• port -- The port used by the service.
• id -- Unique ID to identify the service, if not provided the value of the name parameter is used.
• tags -- Identifying tags for service, string or list.
• check_ttl -- If a TTL type is used, then the TTL update endpoint must be used periodically to update the state of the check.
• check_interval -- Interval at which the check should run.
salt '*' consul.agent_service_register name='redis' tags='["master", "v1"]' address="127.0.0.1" port="8080" check_script="/usr/local/bin/check_redis.py" interval="10s"
salt.modules.consul.agent_services(consul_url=None, token=None) Returns the services the local agent is managing
Returns Returns the services the local agent is managing
salt '*' consul.agent_services
salt.modules.consul.catalog_datacenters(consul_url=None, token=None) Return list of available datacenters from catalog.
Returns The list of available datacenters.
salt '*' consul.catalog_datacenters
salt.modules.consul.catalog_deregister(consul_url=None, token=None, **kwargs) Deregisters a node, service, or check
• node -- The node to deregister.
• datacenter -- By default, the datacenter of the agent is queried; however, the dc can be provided using the "dc" parameter.
• checkid -- The ID of the health check to deregister.
• serviceid -- The ID of the service to deregister.
salt '*' consul.catalog_register node='node1' serviceid='redis_server1' checkid='redis_check1'
salt.modules.consul.catalog_node(consul_url=None, token=None, node=None, **kwargs) Information about the registered node.
• node -- The node to request information about.
• dc -- By default, the datacenter of the agent is queried; however, the dc can be provided using the "dc" parameter.
Returns Information about the requested node.
salt '*' consul.catalog_service service='redis'
salt.modules.consul.catalog_nodes(consul_url=None, token=None, **kwargs) Return list of available nodes from catalog.
Returns The list of available nodes.
salt '*' consul.catalog_nodes
salt.modules.consul.catalog_register(consul_url=None, token=None, **kwargs) Registers a new node, service, or check
• node -- The node to register.
• address -- The address of the node.
• service -- The service that will be registered.
• service_address -- The address that the service listens on.
• service_port -- The port for the service.
• service_id -- A unique identifier for the service, if this is not provided "name" will be used.
• service_tags -- Any tags associated with the service.
• check -- The name of the health check to register
• check_status -- The initial status of the check, must be one of unknown, passing, warning, or critical.
• check_service -- The service that the check is performed against.
• check_id -- Unique identifier for the service.
• check_notes -- An opaque field that is meant to hold human-readable text.
salt '*' consul.catalog_register node='node1' address='192.168.1.1' service='redis' service_address='127.0.0.1' service_port='8080' service_id='redis_server1'
salt.modules.consul.catalog_service(consul_url=None, token=None, service=None, **kwargs) Information about the registered service.
• tag -- Filter returned services with tag parameter.
Returns Information about the requested service.
salt.modules.consul.catalog_services(consul_url=None, token=None, **kwargs) Return list of available services rom catalog.
Returns The list of available services.
salt '*' consul.catalog_services
salt.modules.consul.delete(consul_url=None, token=None, key=None, **kwargs) Delete values from Consul
• key -- The key to use as the starting point for the list.
• recurse -- Delete values recursively beginning at the value of key.
• cas -- This flag is used to turn the DELETE into a Check-And-Set operation.
salt '*' consul.delete key='web' salt '*' consul.delete key='web' recurse='True'
salt.modules.consul.event_fire(consul_url=None, token=None, name=None, **kwargs) List the ACL tokens.
• name -- The name of the event to fire.
• node -- Filter by node name.
• service -- Filter by service name.
• tag -- Filter by tag name.
salt '*' consul.event_fire name='deploy'
salt.modules.consul.event_list(consul_url=None, token=None, **kwargs) List the recent events.
salt '*' consul.event_list
salt.modules.consul.get(consul_url=None, key=None, token=None, recurse=False, decode=False, raw=False) Get key from Consul
• recurse -- Return values recursively beginning at the value of key.
• decode -- By default values are stored as Base64 encoded values, decode will return the whole key with the value decoded.
• raw -- Simply return the decoded value of the key.
Returns The keys in Consul.
salt '*' consul.get key='web/key1' salt '*' consul.get key='web' recurse=True salt '*' consul.get key='web' recurse=True decode=True
By default values stored in Consul are base64 encoded, passing the decode option will show them as the decoded values.
salt '*' consul.get key='web' recurse=True decode=True raw=True
By default Consult will return other information about the key, the raw option will return only the raw value.
salt.modules.consul.health_checks(consul_url=None, token=None, service=None, **kwargs) Health information about the registered service.
• service -- The service to request health information about.
Returns Health information about the requested node.
salt '*' consul.health_checks service='redis1'
salt.modules.consul.health_node(consul_url=None, token=None, node=None, **kwargs) Health information about the registered node.
• node -- The node to request health information about.
salt '*' consul.health_node node='node1'
salt.modules.consul.health_service(consul_url=None, token=None, service=None, **kwargs) Health information about the registered service.
• passing -- Filter results to only nodes with all checks in the passing state.
salt '*' consul.health_service service='redis1'
salt '*' consul.health_service service='redis1' passing='True'
salt.modules.consul.health_state(consul_url=None, token=None, state=None, **kwargs) Returns the checks in the state provided on the path.
• state -- The state to show checks for. The supported states are any, unknown, passing, warning, or critical. The any state is a wildcard that can be used to return all checks.
Returns The checks in the provided state.
salt '*' consul.health_state state='redis1'
salt '*' consul.health_state service='redis1' passing='True'
salt.modules.consul.list_(consul_url=None, token=None, key=None, **kwargs) List keys in Consul
Returns The list of keys.
salt '*' consul.list salt '*' consul.list key='web'
salt.modules.consul.put(consul_url=None, token=None, key=None, value=None, **kwargs) Put values into Consul
• value -- The value to set the key to.
• flags -- This can be used to specify an unsigned value between 0 and 2^64-1. Clients can choose to use this however makes sense for their application.
• cas -- This flag is used to turn the PUT into a Check-And-Set operation.
• acquire -- This flag is used to turn the PUT into a lock acquisition operation.
• release -- This flag is used to turn the PUT into a lock release operation.
salt '*' consul.put key='web/key1' value="Hello there"
salt '*' consul.put key='web/key1' value="Hello there" acquire='d5d371f4-c380-5280-12fd-8810be175592'
salt '*' consul.put key='web/key1' value="Hello there" release='d5d371f4-c380-5280-12fd-8810be175592'
salt.modules.consul.session_create(consul_url=None, token=None, **kwargs) Used to create a session.
• lockdelay -- Duration string using a "s" suffix for seconds.  The default is 15s.
• node -- Must refer to a node that is already registered, if specified. By default, the agent's own node name is used.
• name -- A human-readable name for the session
• checks -- A list of associated health checks. It is highly recommended that, if you override this list, you include the default "serfHealth".
• behavior -- Can be set to either release or delete. This controls the behavior when a session is invalidated. By default, this is release, causing any locks that are held to be released. Changing this to delete causes any locks that are held to be deleted. delete is useful for creating ephemeral key/value entries.
• ttl -- Session is invalidated if it is not renewed before the TTL expires
salt '*' consul.session_create node='node1' name='my-session' behavior='delete' ttl='3600s'
salt.modules.consul.session_destroy(consul_url=None, token=None, session=None, **kwargs) Destroy session
• session -- The ID of the session to destroy.
salt '*' consul.session_destroy session='c1c4d223-91cb-3d1f-1ee8-f2af9e7b6716'
salt.modules.consul.session_info(consul_url=None, token=None, session=None, **kwargs) Information about a session
• session -- The ID of the session to return information about.
salt '*' consul.session_info session='c1c4d223-91cb-3d1f-1ee8-f2af9e7b6716'
salt.modules.consul.session_list(consul_url=None, token=None, return_list=False, **kwargs) Used to list sessions.
• return_list -- By default, all information about the sessions is returned, using the return_list parameter will return a list of session IDs.
Returns A list of all available sessions.
salt '*' consul.session_list
salt.modules.consul.status_leader(consul_url=None, token=None) Returns the current Raft leader
Returns The address of the Raft leader.
salt '*' consul.status_leader
salt.modules.consul.status_peers(consul_url, token=None) Returns the current Raft peer set
Returns Retrieves the Raft peers for the datacenter in which the agent is running.
salt '*' consul.status_peers
salt.modules.container_resource Common resources for LXC and systemd-nspawn containers
These functions are not designed to be called directly, but instead from the lxc, nspawn, and docker execution modules. They provide for common logic to be re-used for common actions.
salt.modules.container_resource.cache_file(source) Wrapper for cp.cache_file which raises an error if the file was unable to be cached.
salt myminion container_resource.cache_file salt://foo/bar/baz.txt
salt.modules.container_resource.copy_to(name, source, dest, container_type=None, path=None, exec_driver=None, overwrite=False, makedirs=False) Common logic for copying files to containers
path   path to the container parent (for LXC only) default: /var/lib/lxc (system default)
salt myminion container_resource.copy_to mycontainer /local/file/path /container/file/path container_type=docker exec_driver=nsenter
salt.modules.container_resource.run(name, cmd, container_type=None, exec_driver=None, output=None, no_start=False, stdin=None, python_shell=True, output_loglevel='debug', ignore_retcode=False, path=None, use_vt=False, keep_env=None) Common logic for running shell commands in containers
salt myminion container_resource.run mycontainer 'ps aux' container_type=docker exec_driver=nsenter output=stdout
salt.modules.cp Minion side functions for salt-cp
salt.modules.cp.cache_dest(url, saltenv='base') New in version 3000.
Returns the expected cache path for the file, if cached using cp.cache_file.
NOTE: This only returns the _expected_ path, it does not tell you if the URL is really cached. To check if the URL is cached, use cp.is_cached instead.
salt '*' cp.cache_dest https://foo.com/bar.rpm salt '*' cp.cache_dest salt://my/file salt '*' cp.cache_dest salt://my/file saltenv=dev
salt.modules.cp.cache_dir(path, saltenv='base', include_empty=False, include_pat=None, exclude_pat=None) Download and cache everything under a directory from the master
include_pat None Glob or regex to narrow down the files cached from the given path. If matching with a regex, the regex must be prefixed with E@, otherwise the expression will be interpreted as a glob.
exclude_pat None Glob or regex to exclude certain files from being cached from the given path. If matching with a regex, the regex must be prefixed with E@, otherwise the expression will be interpreted as a glob.
NOTE: If used with include_pat, files matching this pattern will be excluded from the subset of files defined by include_pat.
salt '*' cp.cache_dir salt://path/to/dir salt '*' cp.cache_dir salt://path/to/dir include_pat='E@*.py$'
salt.modules.cp.cache_file(path, saltenv='base', source_hash=None, verify_ssl=True) Used to cache a single file on the Minion
Returns the location of the new cached file on the Minion
source_hash If name is an http(s) or ftp URL and the file exists in the minion's file cache, this option can be passed to keep the minion from re-downloading the file if the cached copy matches the specified hash.
verify_ssl If False, remote https file sources (https://) and source_hash will not attempt to validate the servers certificate. Default is True.
salt '*' cp.cache_file salt://path/to/file
There are two ways of defining the fileserver environment (a.k.a. saltenv) from which to cache the file. One is to use the saltenv parameter, and the other is to use a querystring syntax in the salt:// URL. The below two examples are equivalent:
salt '*' cp.cache_file salt://foo/bar.conf saltenv=config salt '*' cp.cache_file salt://foo/bar.conf?saltenv=config
If the path being cached is a salt:// URI, and the path does not exist, then False will be returned.
NOTE: It may be necessary to quote the URL when using the querystring method, depending on the shell being used to run the command.
salt.modules.cp.cache_files(paths, saltenv='base') Used to gather many files from the Master, the gathered files will be saved in the minion cachedir reflective to the paths retrieved from the Master
salt '*' cp.cache_files salt://pathto/file1,salt://pathto/file1
There are two ways of defining the fileserver environment (a.k.a. saltenv) from which to cache the files. One is to use the saltenv parameter, and the other is to use a querystring syntax in the salt:// URL. The below two examples are equivalent:
salt '*' cp.cache_files salt://foo/bar.conf,salt://foo/baz.conf saltenv=config salt '*' cp.cache_files salt://foo/bar.conf?saltenv=config,salt://foo/baz.conf?saltenv=config
The querystring method is less useful when all files are being cached from the same environment, but is a good way of caching files from multiple different environments in the same command. For example, the below command will cache the first file from the config1 environment, and the second one from the config2 environment.
salt '*' cp.cache_files salt://foo/bar.conf?saltenv=config1,salt://foo/bar.conf?saltenv=config2
salt.modules.cp.cache_local_file(path) Cache a local file on the minion in the localfiles cache
salt '*' cp.cache_local_file /etc/hosts
salt.modules.cp.cache_master(saltenv='base') Retrieve all of the files on the master and cache them locally
salt '*' cp.cache_master
salt.modules.cp.envs() List available environments for fileserver
salt '*' cp.envs
salt.modules.cp.get_dir(path, dest, saltenv='base', template=None, gzip=None, **kwargs) Used to recursively copy a directory from the salt master
salt '*' cp.get_dir salt://path/to/dir/ /minion/dest
get_dir supports the same template and gzip arguments as get_file.
salt.modules.cp.get_file(path, dest, saltenv='base', makedirs=False, template=None, gzip=None, **kwargs) Changed in version 2018.3.0: dest can now be a directory
Used to get a single file from the salt master
salt '*' cp.get_file salt://path/to/file /minion/dest
This example would instruct all Salt minions to download the vimrc from a directory with the same name as their os grain and copy it to /etc/vimrc
For larger files, the cp.get_file module also supports gzip compression.  Because gzip is CPU-intensive, this should only be used in scenarios where the compression ratio is very high (e.g. pretty-printed JSON or YAML files).
Use the gzip named argument to enable it.  Valid values are 1..9, where 1 is the lightest compression and 9 the heaviest.  1 uses the least CPU on the master (and minion), 9 uses the most.
There are two ways of defining the fileserver environment (a.k.a. saltenv) from which to retrieve the file. One is to use the saltenv parameter, and the other is to use a querystring syntax in the salt:// URL. The below two examples are equivalent:
salt '*' cp.get_file salt://foo/bar.conf /etc/foo/bar.conf saltenv=config salt '*' cp.get_file salt://foo/bar.conf?saltenv=config /etc/foo/bar.conf
salt.modules.cp.get_file_str(path, saltenv='base') Download a file from a URL to the Minion cache directory and return the contents of that file
Returns False if Salt was unable to cache a file from a URL.
salt '*' cp.get_file_str salt://my/file
salt.modules.cp.get_template(path, dest, template='jinja', saltenv='base', makedirs=False, **kwargs) Render a file as a template before setting it down.  Warning, order is not the same as in fileclient.cp for non breaking old API.
salt '*' cp.get_template salt://path/to/template /minion/dest
salt.modules.cp.get_url(path, dest='', saltenv='base', makedirs=False, source_hash=None) Changed in version 2018.3.0: dest can now be a directory
Used to get a single file from a URL.
path   A URL to download a file from. Supported URL schemes are: salt://, http://, https://, ftp://, s3://, swift:// and file:// (local filesystem). If no scheme was specified, this is equivalent of using file://.  If a file:// URL is given, the function just returns absolute path to that file on a local filesystem.  The function returns False if Salt was unable to fetch a file from a salt:// URL.
dest   The default behaviour is to write the fetched file to the given destination path. If this parameter is omitted or set as empty string (''), the function places the remote file on the local filesystem inside the Minion cache directory and returns the path to that file.
NOTE: To simply return the file contents instead, set destination to None. This works with salt://, http://, https:// and file:// URLs. The files fetched by http:// and https:// will not be cached.
saltenv base Salt fileserver environment from which to retrieve the file. Ignored if path is not a salt:// URL.
source_hash If path is an http(s) or ftp URL and the file exists in the minion's file cache, this option can be passed to keep the minion from re-downloading the file if the cached copy matches the specified hash.
salt '*' cp.get_url salt://my/file /tmp/this_file_is_mine salt '*' cp.get_url http://www.slashdot.org /tmp/index.html
salt.modules.cp.hash_file(path, saltenv='base') Return the hash of a file, to get the hash of a file on the salt master file server prepend the path with salt://<file on server> otherwise, prepend the file with / for a local file.
salt '*' cp.hash_file salt://path/to/file
salt.modules.cp.is_cached(path, saltenv='base') Returns the full path to a file if it is cached locally on the minion otherwise returns a blank string
salt '*' cp.is_cached salt://path/to/file
salt.modules.cp.list_master(saltenv='base', prefix='') List all of the files stored on the master
salt '*' cp.list_master
salt.modules.cp.list_master_dirs(saltenv='base', prefix='') List all of the directories stored on the master
salt '*' cp.list_master_dirs
salt.modules.cp.list_master_symlinks(saltenv='base', prefix='') List all of the symlinks stored on the master
salt '*' cp.list_master_symlinks
salt.modules.cp.list_minion(saltenv='base') List all of the files cached on the minion
salt '*' cp.list_minion
salt.modules.cp.list_states(saltenv='base') List all of the available state modules in an environment
salt '*' cp.list_states
salt.modules.cp.push(path, keep_symlinks=False, upload_path=None, remove_source=False) WARNING Files pushed to the master will have global read permissions..
Push a file from the minion up to the master, the file will be saved to the salt master in the master's minion files cachedir (defaults to /var/cache/salt/master/minions/minion-id/files)
Since this feature allows a minion to push a file up to the master server it is disabled by default for security purposes. To enable, set file_recv to True in the master configuration file, and restart the master.
keep_symlinks Keep the path value without resolving its canonical form
upload_path Provide a different path inside the master's minion files cachedir
remove_source Remove the source file on the minion
salt '*' cp.push /etc/fstab salt '*' cp.push /etc/system-release keep_symlinks=True salt '*' cp.push /etc/fstab upload_path='/new/path/fstab' salt '*' cp.push /tmp/filename remove_source=True
salt.modules.cp.push_dir(path, glob=None, upload_path=None) Push a directory from the minion up to the master, the files will be saved to the salt master in the master's minion files cachedir (defaults to /var/cache/salt/master/minions/minion-id/files).  It also has a glob for matching specific files using globbing.
Since this feature allows a minion to push files up to the master server it is disabled by default for security purposes. To enable, set file_recv to True in the master configuration file, and restart the master.
upload_path Provide a different path and directory name inside the master's minion files cachedir
salt '*' cp.push /usr/lib/mysql salt '*' cp.push /usr/lib/mysql upload_path='/newmysql/path' salt '*' cp.push_dir /etc/modprobe.d/ glob='*.conf'
salt.modules.cp.recv(files, dest) Used with salt-cp, pass the files dict, and the destination.
This function receives small fast copy files from the master via salt-cp.  It does not work via the CLI.
salt.modules.cp.recv_chunked(dest, chunk, append=False, compressed=True, mode=None) This function receives files copied to the minion using salt-cp and is not intended to be used directly on the CLI.
salt.modules.cp.stat_file(path, saltenv='base', octal=True) Return the permissions of a file, to get the permissions of a file on the salt master file server prepend the path with salt://<file on server> otherwise, prepend the file with / for a local file.
salt '*' cp.stat_file salt://path/to/file
salt.modules.cpan Manage Perl modules using CPAN
salt.modules.cpan.install(module) Install a Perl module from CPAN
salt '*' cpan.install Template::Alloy
salt.modules.cpan.list_() List installed Perl modules, and the version installed
salt '*' cpan.list
salt.modules.cpan.remove(module, details=False) Attempt to remove a Perl module that was installed from CPAN. Because the cpan command doesn't actually support "uninstall"-like functionality, this function will attempt to do what it can, with what it has from CPAN.
Until this function is declared stable, USE AT YOUR OWN RISK!
salt '*' cpan.remove Old::Package
salt.modules.cpan.show(module) Show information about a specific Perl module
salt '*' cpan.show Template::Alloy
salt.modules.cpan.show_config() Return a dict of CPAN configuration values
salt '*' cpan.show_config
salt.modules.cron Work with cron
NOTE: Salt does not escape cron metacharacters automatically. You should backslash-escape percent characters and any other metacharacters that might be interpreted incorrectly by the shell.
salt.modules.cron.get_entry(user, identifier=None, cmd=None) Return the specified entry from user's crontab.  identifier will be used if specified, otherwise will lookup cmd Either identifier or cmd should be specified.
user:  User's crontab to query
identifier: Search for line with identifier
cmd:   Search for cron line with cmd
salt '*' cron.get_entry root identifier=task1
salt.modules.cron.list_tab(user) Return the contents of the specified user's crontab
salt '*' cron.list_tab root
salt.modules.cron.ls(user) This function is an alias of list_tab. Return the contents of the specified user's crontab
salt.modules.cron.raw_cron(user) Return the contents of the user's crontab
salt '*' cron.raw_cron root
salt.modules.cron.rm(user, cmd, minute=None, hour=None, daymonth=None, month=None, dayweek=None, identifier=None) This function is an alias of rm_job. Remove a cron job for a specified user. If any of the day/time params are specified, the job will only be removed if the specified params match.
salt '*' cron.rm_job root /usr/local/weekly salt '*' cron.rm_job root /usr/bin/foo dayweek=1
salt.modules.cron.rm_env(user, name) Remove cron environment variable for a specified user.
salt '*' cron.rm_env root MAILTO
salt.modules.cron.rm_job(user, cmd, minute=None, hour=None, daymonth=None, month=None, dayweek=None, identifier=None) Remove a cron job for a specified user. If any of the day/time params are specified, the job will only be removed if the specified params match.
salt.modules.cron.rm_special(user, cmd, special=None, identifier=None) Remove a special cron job for a specified user.
salt '*' cron.rm_special root /usr/bin/foo
salt.modules.cron.set_env(user, name, value=None) Set up an environment variable in the crontab.
salt '*' cron.set_env root MAILTO user@example.com
salt.modules.cron.set_job(user, minute, hour, daymonth, month, dayweek, cmd, commented=False, comment=None, identifier=None) Sets a cron job up for a specified user.
salt '*' cron.set_job root '*' '*' '*' '*' 1 /usr/local/weekly
salt.modules.cron.set_special(user, special, cmd, commented=False, comment=None, identifier=None) Set up a special command in the crontab.
salt '*' cron.set_special root @hourly 'echo foobar'
salt.modules.cron.write_cron_file(user, path) Writes the contents of a file to a user's crontab
salt '*' cron.write_cron_file root /tmp/new_cron
Changed in version 2015.8.9.
NOTE: Some OS' do not support specifying user via the crontab command i.e. (Solaris, AIX)
salt.modules.cron.write_cron_file_verbose(user, path) Writes the contents of a file to a user's crontab and return error message on error
salt '*' cron.write_cron_file_verbose root /tmp/new_cron
salt.modules.cryptdev Salt module to manage Unix cryptsetup jobs and the crypttab file
salt.modules.cryptdev.active() List existing device-mapper device details.
salt.modules.cryptdev.close(name) Close a crypt device using cryptsetup.
salt '*' cryptdev.close foo
salt.modules.cryptdev.crypttab(config='/etc/crypttab') List the contents of the crypttab
salt '*' cryptdev.crypttab
salt.modules.cryptdev.open(name, device, keyfile) Open a crypt device using cryptsetup. The keyfile must not be None or 'none', because cryptsetup will otherwise ask for the password interactively.
salt '*' cryptdev.open foo /dev/sdz1 /path/to/keyfile
salt.modules.cryptdev.rm_crypttab(name, config='/etc/crypttab') Remove the named mapping from the crypttab. If the described entry does not exist, nothing is changed, but the command succeeds by returning 'absent'. If a line is removed, it returns 'change'.
salt '*' cryptdev.rm_crypttab foo
salt.modules.cryptdev.set_crypttab(name, device, password='none', options='', config='/etc/crypttab', test=False, match_on='name') Verify that this device is represented in the crypttab, change the device to match the name passed, or add the name if it is not present.
salt '*' cryptdev.set_crypttab foo /dev/sdz1 mypassword swap,size=256
salt.modules.csf Support for Config Server Firewall (CSF) maintainer Mostafa Hussein <mostafa.hussein91@gmail.com>
salt.modules.csf.allow(ip, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='s', ttl=None, comment='') Add an rule to csf allowed hosts See _access_rule().  1- Add an IP:
salt '*' csf.allow 127.0.0.1 salt '*' csf.allow 127.0.0.1 comment="Allow localhost"
salt.modules.csf.allow_port(port, proto='tcp', direction='both') Like allow_ports, but it will append to the existing entry instead of replacing it.  Takes a single port instead of a list of ports.
salt '*' csf.allow_port 22 proto='tcp' direction='in'
salt.modules.csf.allow_ports(ports, proto='tcp', direction='in') Fully replace the incoming or outgoing ports line in the csf.conf file - e.g. TCP_IN, TCP_OUT, UDP_IN, UDP_OUT, etc.
salt '*' csf.allow_ports ports="[22,80,443,4505,4506]" proto='tcp' direction='in'
salt.modules.csf.build_directions(direction)
salt.modules.csf.deny(ip, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='d', ttl=None, comment='') Add an rule to csf denied hosts See _access_rule().  1- Deny an IP:
salt '*' csf.deny 127.0.0.1 salt '*' csf.deny 127.0.0.1 comment="Too localhosty"
salt.modules.csf.disable() Disable csf permanently
salt '*' csf.disable
salt.modules.csf.disable_testing_mode()
salt.modules.csf.enable() Activate csf if not running
salt '*' csf.enable
salt.modules.csf.enable_testing_mode()
salt.modules.csf.exists(method, ip, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='d', ttl=None, comment='') Returns true a rule for the ip already exists based on the method supplied. Returns false if not found.
salt '*' csf.exists allow 1.2.3.4 salt '*' csf.exists tempdeny 1.2.3.4
salt.modules.csf.get_option(option)
salt.modules.csf.get_ports(proto='tcp', direction='in') Lists ports from csf.conf based on direction and protocol.  e.g. - TCP_IN, TCP_OUT, UDP_IN, UDP_OUT, etc..
salt.modules.csf.get_skipped_nics(ipv6=False)
salt.modules.csf.get_testing_status()
salt.modules.csf.reload() Restart csf
salt '*' csf.reload
salt.modules.csf.remove_rule(method, ip, port=None, proto='tcp', direction='in', port_origin='d', ip_origin='s', ttl=None, comment='')
salt.modules.csf.remove_temp_rule(ip)
salt.modules.csf.running() Check csf status
salt '*' csf.running
salt.modules.csf.set_option(option, value)
salt.modules.csf.skip_nic(nic, ipv6=False)
salt.modules.csf.skip_nics(nics, ipv6=False)
salt.modules.csf.split_option(option)
salt.modules.csf.tempallow(ip=None, ttl=None, port=None, direction=None, comment='') Add an rule to the temporary ip allow list.  See _access_rule(). 1- Add an IP:
salt '*' csf.tempallow 127.0.0.1 3600 port=22 direction='in' comment='# Temp dev ssh access'
salt.modules.csf.tempdeny(ip=None, ttl=None, port=None, direction=None, comment='') Add a rule to the temporary ip deny list.  See _access_rule().  1- Add an IP:
salt '*' csf.tempdeny 127.0.0.1 300 port=22 direction='in' comment='# Brute force attempt'
salt.modules.csf.unallow(ip) Remove a rule from the csf denied hosts See _access_rule().  1- Deny an IP:
salt '*' csf.unallow 127.0.0.1
salt.modules.csf.undeny(ip) Remove a rule from the csf denied hosts See _access_rule().  1- Deny an IP:
salt '*' csf.undeny 127.0.0.1
salt.modules.cyg Manage cygwin packages.
Module file to accompany the cyg state.
salt.modules.cyg.check_valid_package(package, cyg_arch='x86_64', mirrors=None) Check if the package is valid on the given mirrors.
• package -- The name of the package
• cyg_arch -- The cygwin architecture
• mirrors -- any mirrors to check
Returns (bool): True if Valid, otherwise False
salt '*' cyg.check_valid_package <package name>
salt.modules.cyg.install(packages=None, cyg_arch='x86_64', mirrors=None) Install one or several packages.
packages None The packages to install
cyg_arch x86_64 Specify the architecture to install the package under Current options are x86 and x86_64
salt '*' cyg.install dos2unix salt '*' cyg.install dos2unix mirrors="[{'http://mirror': 'http://url/to/public/key}]'
salt.modules.cyg.list_(package='', cyg_arch='x86_64') List locally installed packages.
package '' package name to check. else all
cyg_arch : Cygwin architecture to use Options are x86 and x86_64
salt '*' cyg.list
salt.modules.cyg.uninstall(packages, cyg_arch='x86_64', mirrors=None) Uninstall one or several packages.
packages The packages to uninstall.
cyg_arch x86_64 Specify the architecture to remove the package from Current options are x86 and x86_64
salt '*' cyg.uninstall dos2unix salt '*' cyg.uninstall dos2unix mirrors="[{'http://mirror': 'http://url/to/public/key}]"
salt.modules.cyg.update(cyg_arch='x86_64', mirrors=None) Update all packages.
cyg_arch x86_64 Specify the cygwin architecture update Current options are x86 and x86_64
salt '*' cyg.update salt '*' cyg.update dos2unix mirrors="[{'http://mirror': 'http://url/to/public/key}]"
salt.modules.daemontools daemontools service module. This module will create daemontools type service watcher.
This module is compatible with the service states, so it can be used to maintain services using the provider argument:
myservice: service.running: - provider: daemontools
salt.modules.daemontools.available(name) Returns True if the specified service is available, otherwise returns False.
salt '*' daemontools.available foo
salt.modules.daemontools.disabled(name) Return True if the named service is enabled, false otherwise
New in version 2015.5.6.
salt '*' daemontools.disabled <service name>
salt.modules.daemontools.enabled(name, **kwargs) Return True if the named service is enabled, false otherwise A service is considered enabled if in your service directory: - an executable ./run file exist - a file named "down" does not exist
New in version 2015.5.7.
name   Service name
salt '*' daemontools.enabled <service name>
salt.modules.daemontools.full_restart(name) Calls daemontools.restart() function
salt '*' daemontools.full_restart <service name>
salt.modules.daemontools.get_all() Return a list of all available services
salt '*' daemontools.get_all
salt.modules.daemontools.missing(name) The inverse of daemontools.available.  Returns True if the specified service is not available, otherwise returns False.
salt '*' daemontools.missing foo
salt.modules.daemontools.reload_(name) Wrapper for term()
salt '*' daemontools.reload <service name>
salt.modules.daemontools.restart(name) Restart service via daemontools. This will stop/start service
salt '*' daemontools.restart <service name>
salt.modules.daemontools.start(name) Starts service via daemontools
salt '*' daemontools.start <service name>
salt.modules.daemontools.status(name, sig=None) Return the status for a service via daemontools, return pid if running
salt '*' daemontools.status <service name>
salt.modules.daemontools.stop(name) Stops service via daemontools
salt '*' daemontools.stop <service name>
salt.modules.daemontools.term(name) Send a TERM to service via daemontools
salt '*' daemontools.term <service name>
salt.modules.data Manage a local persistent data structure that can hold any arbitrary data specific to the minion
salt.modules.data.cas(key, value, old_value) Check and set a value in the minion datastore
salt '*' data.cas <key> <value> <old_value>
salt.modules.data.clear() Clear out all of the data in the minion datastore, this function is destructive!
salt '*' data.clear
salt.modules.data.dump(new_data) Replace the entire datastore with a passed data structure
salt '*' data.dump '{'eggs': 'spam'}'
salt.modules.data.get(key, default=None) Get a (list of) value(s) from the minion datastore
salt '*' data.get key salt '*' data.get '["key1", "key2"]'
salt.modules.data.has_key(key) Check if key is in the minion datastore
salt '*' data.has_key <mykey>
salt.modules.data.items() Get items from the minion datastore
salt '*' data.items
salt.modules.data.keys() Get all keys from the minion datastore
salt '*' data.keys
salt.modules.data.load() Return all of the data in the minion datastore
salt '*' data.load
salt.modules.data.pop(key, default=None) Pop (return & delete) a value from the minion datastore
New in version 2015.5.2.
salt '*' data.pop <key> "there was no val"
salt.modules.data.update(key, value) Update a key with a value in the minion datastore
salt '*' data.update <key> <value>
salt.modules.data.values() Get values from the minion datastore
salt '*' data.values
salt.modules.datadog_api An execution module that interacts with the Datadog API
The following parameters are required for all functions.
api_key The datadog API key
app_key The datadog application key
Full argument reference is available on the Datadog API reference page https://docs.datadoghq.com/api/
salt.modules.datadog_api.cancel_downtime(api_key=None, app_key=None, scope=None, id=None) Cancel a downtime by id or by scope.
salt-call datadog.cancel_downtime scope='host:app01' \ api_key='0123456789' \ app_key='9876543210'`
Arguments - Either scope or id is required.
• id -- The downtime ID
• scope -- The downtime scope
salt.modules.datadog_api.post_event(api_key=None, app_key=None, title=None, text=None, date_happened=None, priority=None, host=None, tags=None, alert_type=None, aggregation_key=None, source_type_name=None) Post an event to the Datadog stream.
salt-call datadog.post_event api_key='0123456789' \ app_key='9876543210' \ title='Salt Highstate' \ text="Salt highstate was run on $(salt-call grains.get id)" \ tags='["service:salt", "event:highstate"]'
Required arguments
• title -- The event title. Limited to 100 characters.
• text -- The body of the event. Limited to 4000 characters. The text supports markdown.
• date_happened -- POSIX timestamp of the event.
• priority -- The priority of the event ('normal' or 'low').
• host -- Host name to associate with the event.
• tags -- A list of tags to apply to the event.
• alert_type -- "error", "warning", "info" or "success".
• aggregation_key -- An arbitrary string to use for aggregation, max length of 100 characters.
• source_type_name -- The type of event being posted.
salt.modules.datadog_api.schedule_downtime(scope, api_key=None, app_key=None, monitor_id=None, start=None, end=None, message=None, recurrence=None, timezone=None, test=False) Schedule downtime for a scope of monitors.
salt-call datadog.schedule_downtime 'host:app2' \ stop=$(date --date='30 minutes' +%s) \ app_key='0123456789' \ api_key='9876543210'
• monitor_id -- The ID of the monitor
• start -- Start time in seconds since the epoch
• end -- End time in seconds since the epoch
• message -- A message to send in a notification for this downtime
• recurrence -- Repeat this downtime periodically
• timezone -- Specify the timezone
salt.modules.ddns Support for RFC 2136 dynamic DNS updates.
• dnspython Python module
configuration If you want to use TSIG authentication for the server, there are a couple of optional configuration parameters made available to support this (the keyname is only needed if the keyring contains more than one key):
keyfile: keyring file (default=None) keyname: key name in file (default=None) keyalgorithm: algorithm used to create the key (default='HMAC-MD5.SIG-ALG.REG.INT'). Other possible values: hmac-sha1, hmac-sha224, hmac-sha256, hmac-sha384, hmac-sha512
The keyring file needs to be in json format and the key name needs to end with an extra period in the file, similar to this:
{"keyname.": "keycontent"}
salt.modules.ddns.add_host(zone, name, ttl, ip, nameserver='127.0.0.1', replace=True, timeout=5, port=53, **kwargs) Add, replace, or update the A and PTR (reverse) records for a host.
salt ns1 ddns.add_host example.com host1 60 10.1.1.1
salt.modules.ddns.delete(zone, name, rdtype=None, data=None, nameserver='127.0.0.1', timeout=5, port=53, **kwargs) Delete a DNS record.
salt ns1 ddns.delete example.com host1 A
salt.modules.ddns.delete_host(zone, name, nameserver='127.0.0.1', timeout=5, port=53, **kwargs) Delete the forward and reverse records for a host.
Returns true if any records are deleted.
salt ns1 ddns.delete_host example.com host1
salt.modules.ddns.update(zone, name, ttl, rdtype, data, nameserver='127.0.0.1', timeout=5, replace=False, port=53, **kwargs) Add, replace, or update a DNS record.  nameserver must be an IP address and the minion running this module must have update privileges on that server.  If replace is true, first deletes all records for this name and type.
salt ns1 ddns.update example.com host1 60 A 10.0.0.1
salt.modules.deb_apache Support for Apache
Please note: The functions in here are Debian-specific. Placing them in this separate file will allow them to load only on Debian-based systems, while still loading under the apache namespace.
salt.modules.deb_apache.a2disconf(conf) New in version 2016.3.0.
Runs a2disconf for the given conf.
This will only be functional on Debian-based operating systems (Ubuntu, Mint, etc).
salt '*' apache.a2disconf security
salt.modules.deb_apache.a2dismod(mod) Runs a2dismod for the given mod.
salt '*' apache.a2dismod vhost_alias
salt.modules.deb_apache.a2dissite(site) Runs a2dissite for the given site.
salt '*' apache.a2dissite example.com
salt.modules.deb_apache.a2enconf(conf) New in version 2016.3.0.
Runs a2enconf for the given conf.
salt '*' apache.a2enconf security
salt.modules.deb_apache.a2enmod(mod) Runs a2enmod for the given mod.
salt '*' apache.a2enmod vhost_alias
salt.modules.deb_apache.a2ensite(site) Runs a2ensite for the given site.
salt '*' apache.a2ensite example.com
salt.modules.deb_apache.check_conf_enabled(conf) New in version 2016.3.0.
Checks to see if the specific conf symlink is in /etc/apache2/conf-enabled.
salt '*' apache.check_conf_enabled security salt '*' apache.check_conf_enabled security.conf
salt.modules.deb_apache.check_mod_enabled(mod) Checks to see if the specific mod symlink is in /etc/apache2/mods-enabled.
salt '*' apache.check_mod_enabled status salt '*' apache.check_mod_enabled status.load salt '*' apache.check_mod_enabled status.conf