salt.grains.core

The static grains, these are the core, or built in grains.

When grains are loaded they are not loaded in the same way that modules are loaded, grain functions are detected and executed, the functions MUST return a dict which will be applied to the main grains dict. This module will always be executed first, so that any grains loaded here in the core module can be overwritten just by returning dict keys with the same value as those returned here

salt.grains.core.append_domain()

Return append_domain if set

salt.grains.core.cwd()

Current working directory

salt.grains.core.default_gateway()

Populates grains which describe whether a server has a default gateway configured or not. Uses ip -4 route show and ip -6 route show and greps for a default at the beginning of any line. Assuming the standard default via <ip> format for default gateways, it will also parse out the ip address of the default gateway, and put it in ip4_gw or ip6_gw.

If the ip command is unavailable, no grains will be populated.

Currently does not support multiple default gateways. The grains will be set to the first default gateway found.

List of grains:

ip4_gw: True # ip/True/False if default ipv4 gateway ip6_gw: True # ip/True/False if default ipv6 gateway ip_gw: True # True if either of the above is True, False otherwise

salt.grains.core.dns()

Parse the resolver configuration file

New in version 2016.3.0.

salt.grains.core.fqdns()

Return all known FQDNs for the system by enumerating all interfaces and then trying to reverse resolve them (excluding 'lo' interface). To disable the fqdns grain, set enable_fqdns_grains: False in the minion configuration file.

salt.grains.core.get_machine_id()

Provide the machine-id for machine/virtualization combination

salt.grains.core.get_master()

Provides the minion with the name of its master. This is useful in states to target other services running on the master.

salt.grains.core.get_server_id()

Provides an integer based on the FQDN of a machine. Useful as server-id in MySQL replication or anywhere else you'll need an ID like this.

salt.grains.core.hostname()

Return fqdn, hostname, domainname

Note

On Windows the domain grain may refer to the dns entry for the host instead of the Windows domain to which the host is joined. It may also be empty if not a part of any domain. Refer to the windowsdomain grain instead

salt.grains.core.hwaddr_interfaces()

Provide a dict of the connected interfaces and their hw addresses (Mac Address)

salt.grains.core.id_()

Return the id

salt.grains.core.ip4_interfaces()

Provide a dict of the connected interfaces and their ip4 addresses The addresses will be passed as a list for each interface

salt.grains.core.ip6_interfaces()

Provide a dict of the connected interfaces and their ip6 addresses The addresses will be passed as a list for each interface

salt.grains.core.ip_fqdn()

Return ip address and FQDN grains

salt.grains.core.ip_interfaces()

Provide a dict of the connected interfaces and their ip addresses The addresses will be passed as a list for each interface

salt.grains.core.kernelparams()

Return the kernel boot parameters

salt.grains.core.locale_info()
Provides

defaultlanguage defaultencoding

salt.grains.core.os_data()

Return grains pertaining to the operating system

salt.grains.core.path()

Return the path

salt.grains.core.pythonexecutable()

Return the python executable in use

salt.grains.core.pythonpath()

Return the Python path

salt.grains.core.pythonversion()

Return the Python version

salt.grains.core.saltpath()

Return the path of the salt module

salt.grains.core.saltversion()

Return the version of salt

salt.grains.core.saltversioninfo()

Return the version_info of salt

New in version 0.17.0.

salt.grains.core.zmqversion()

Return the zeromq version