The function cache system allows for data to be stored on the master so it can be easily read by other minions
salt.modules.mine.
delete
(fun)¶Remove specific function contents of minion. Returns True on success.
CLI Example:
salt '*' mine.delete 'network.interfaces'
salt.modules.mine.
flush
()¶Remove all mine contents of minion. Returns True on success.
CLI Example:
salt '*' mine.flush
salt.modules.mine.
get
(tgt, fun, tgt_type='glob', exclude_minion=False, expr_form=None)¶Get data from the mine based on the target, function and tgt_type
Targets can be matched based on any standard matching system that can be matched on the master via these keywords:
Note that all pillar matches, whether using the compound matching system or the pillar matching system, will be exact matches, with globbing disabled.
CLI Example:
salt '*' mine.get '*' network.interfaces
salt '*' mine.get 'os:Fedora' network.interfaces grain
salt '*' mine.get 'os:Fedora and S@192.168.5.0/24' network.ipaddrs compound
See also
Retrieving Mine data from Pillar and Orchestrate
This execution module is intended to be executed on minions.
Master-side operations such as Pillar or Orchestrate that require Mine
data should use the Mine Runner module
instead; it can be invoked from a Pillar SLS file using the
saltutil.runner
module. For
example:
{% set minion_ips = salt.saltutil.runner('mine.get',
tgt='*',
fun='network.ip_addrs',
tgt_type='glob') %}
salt.modules.mine.
get_docker
(interfaces=None, cidrs=None, with_container_id=False)¶Get all mine data for 'docker.get_containers' and run an aggregation routine. The "interfaces" parameter allows for specifying which network interfaces to select ip addresses from. The "cidrs" parameter allows for specifying a list of cidrs which the ip address must match.
Boolean, to expose container_id in the list of results
New in version 2015.8.2.
CLI Example:
salt '*' mine.get_docker
salt '*' mine.get_docker interfaces='eth0'
salt '*' mine.get_docker interfaces='["eth0", "eth1"]'
salt '*' mine.get_docker cidrs='107.170.147.0/24'
salt '*' mine.get_docker cidrs='["107.170.147.0/24", "172.17.42.0/24"]'
salt '*' mine.get_docker interfaces='["eth0", "eth1"]' cidrs='["107.170.147.0/24", "172.17.42.0/24"]'
salt.modules.mine.
send
(func, *args, **kwargs)¶Send a specific function to the mine.
CLI Example:
salt '*' mine.send network.ip_addrs eth0
salt '*' mine.send eth0_ip_addrs mine_function=network.ip_addrs eth0
salt.modules.mine.
update
(clear=False, mine_functions=None)¶Execute the configured functions and send the data back up to the master. The functions to be executed are merged from the master config, pillar and minion config under the option mine_functions:
mine_functions:
network.ip_addrs:
- eth0
disk.usage: []
This function accepts the following arguments:
Update the mine data on certain functions only. This feature can be used when updating the mine for functions that require refresh at different intervals than the rest of the functions specified under mine_functions in the minion/master config or pillar. A potential use would be together with the scheduler, for example:
schedule:
lldp_mine_update:
function: mine.update
kwargs:
mine_functions:
net.lldp: []
hours: 12
In the example above, the mine for net.lldp would be refreshed every 12 hours, while network.ip_addrs would continue to be updated as specified in mine_interval.
The function cache will be populated with information from executing these functions
CLI Example:
salt '*' mine.update
salt.modules.mine.
valid
()¶List valid entries in mine configuration.
CLI Example:
salt '*' mine.valid
Docs for previous releases are available on readthedocs.org.
Latest Salt release: 2017.7.2