salt.modules.mine

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, expr_form='glob')

Get data from the mine based on the target, function and expr_form

Targets can be matched based on any standard matching system that can be matched on the master via these keywords:

glob
pcre
grain
grain_pcre
compound
pillar
pillar_pcre

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
salt.modules.mine.get_docker(interfaces=None, cidrs=None)

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.

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)

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 "function_cache":

mine_functions:
  network.ip_addrs:
    - eth0
  disk.usage: []

The function cache will be populated with information from executing these functions

CLI Example:

salt '*' mine.update