Skip to content
This repository was archived by the owner on Oct 12, 2020. It is now read-only.

10. salt grains and junos facts

Khelil Sator edited this page Jun 30, 2017 · 5 revisions

Grains are static information collected from the minions.

Minions grains:

Available grains can be listed by using the 'grains.ls' module:

# salt minion_1 grains.ls
minion_1:
    - SSDs
    - biosreleasedate
    - biosversion
    - cpu_flags
    - cpu_model
    - cpuarch
    - disks
    - dns
    - domain
    - fqdn
    - fqdn_ip4
    - fqdn_ip6
    - gid
    - gpus
    - groupname
    - host
    - hwaddr_interfaces
    - id
    - init
    - ip4_interfaces
    - ip6_interfaces
    - ip_interfaces
    - ipv4
    - ipv6
    - kernel
    - kernelrelease
    - locale_info
    - localhost
    - lsb_distrib_codename
    - lsb_distrib_description
    - lsb_distrib_id
    - lsb_distrib_release
    - machine_id
    - manufacturer
    - master
    - mdadm
    - mem_total
    - nodename
    - num_cpus
    - num_gpus
    - os
    - os_family
    - osarch
    - oscodename
    - osfinger
    - osfullname
    - osmajorrelease
    - osrelease
    - osrelease_info
    - path
    - pid
    - productname
    - ps
    - pythonexecutable
    - pythonpath
    - pythonversion
    - saltpath
    - saltversion
    - saltversioninfo
    - serialnumber
    - server_id
    - shell
    - uid
    - username
    - uuid
    - virtual
    - zmqversion

Return one or more grains:

# salt minion_1 grains.item os_family saltversion
minion_1:
    ----------
    os_family:
        Debian
    saltversion:
        2017.7.0-210-gc89cd2a

Return all grains:

# salt minion_1 grains.items

Junos facts

Displays the facts gathered during the connection:

# salt ex4200-7 junos.facts
ex4200-7:
    ----------
    facts:
        ----------
        2RE:
            False
        HOME:
            /var/home/remote
        RE0:
            ----------
            last_reboot_reason:
                0x2:watchdog
            mastership_state:
                master
            model:
                EX4200-48T, 8 POE
            status:
                OK
            up_time:
                281 days, 46 minutes, 58 seconds
        RE1:
            None
        RE_hw_mi:
            False
        current_re:
            - master
            - node
            - fwdd
            - member
            - pfem
            - fpc0
            - feb0
            - fpc16
        domain:
            poc-nl.jnpr.net
        fqdn:
            sac.poc-nl.jnpr.net
        hostname:
            sac
        hostname_info:
            ----------
            fpc0:
                sac
        ifd_style:
            SWITCH
        junos_info:
            ----------
            fpc0:
                ----------
                object:
                    ----------
                    build:
                        2
                    major:
                        - 12
                        - 3
                    minor:
                        11
                    type:
                        R
                text:
                    12.3R11.2
        master:
            RE0
        model:
            EX4200-48T
        model_info:
            ----------
            fpc0:
                EX4200-48T
        personality:
            SWITCH
        re_info:
            ----------
            default:
                ----------
                0:
                    ----------
                    last_reboot_reason:
                        0x2:watchdog
                    mastership_state:
                        master
                    model:
                        EX4200-48T, 8 POE
                    status:
                        OK
                default:
                    ----------
                    last_reboot_reason:
                        0x2:watchdog
                    mastership_state:
                        master
                    model:
                        EX4200-48T, 8 POE
                    status:
                        OK
        re_master:
            ----------
            default:
                0
        serialnumber:
            BP0208111225
        srx_cluster:
            None
        srx_cluster_id:
            None
        srx_cluster_redundancy_group:
            None
        switch_style:
            VLAN
        vc_capable:
            True
        vc_fabric:
            False
        vc_master:
            0
        vc_mode:
            Mixed
        version:
            12.3R11.2
        version_RE0:
            None
        version_RE1:
            None
        version_info:
            ----------
            build:
                2
            major:
                - 12
                - 3
            minor:
                11
            type:
                R
        virtual:
            False
    out:
        True

Proxies grains:

Junos facts are stored in proxy grains

Available grains can be listed by using grains.ls:

# salt ex4200-7 grains.ls
ex4200-7:
    - cpuarch
    - dns
    - gpus
    - hwaddr_interfaces
    - id
    - junos_facts
    - kernel
    - kernelrelease
    - locale_info
    - machine_id
    - master
    - mem_total
    - nodename
    - num_gpus
    - os
    - os_family
    - osarch
    - osfinger
    - osfullname
    - osrelease
    - osrelease_info
    - path
    - ps
    - pythonexecutable
    - pythonpath
    - pythonversion
    - saltpath
    - saltversion
    - saltversioninfo
    - virtual
    - zmqversion

Return all of the grains:

# salt ex4200-7 grains.items
ex4200-7:
    ----------
    cpuarch:
        x86_64
    dns:
        ----------
        domain:
        ip4_nameservers:
            - 127.0.1.1
        ip6_nameservers:
        nameservers:
            - 127.0.1.1
        options:
        search:
        sortlist:
    gpus:
    hwaddr_interfaces:
        ----------
        ens33:
            00:0c:29:11:2e:cd
        lo:
            00:00:00:00:00:00
    id:
        ex4200-7
    junos_facts:
        ----------
        2RE:
            False
        HOME:
            /var/home/remote
        RE0:
            ----------
            last_reboot_reason:
                0x2:watchdog
            mastership_state:
                master
            model:
                EX4200-48T, 8 POE
            status:
                OK
            up_time:
                283 days, 21 hours, 12 minutes, 32 seconds
        RE1:
            None
        RE_hw_mi:
            False
        current_re:
            - master
            - node
            - fwdd
            - member
            - pfem
            - fpc0
            - feb0
            - fpc16
        domain:
            poc-nl.jnpr.net
        fqdn:
            sac.poc-nl.jnpr.net
        hostname:
            sac
        hostname_info:
            ----------
            fpc0:
                sac
        ifd_style:
            SWITCH
        junos_info:
            ----------
            fpc0:
                ----------
                object:
                    ----------
                    build:
                        2
                    major:
                        - 12
                        - 3
                    minor:
                        11
                    type:
                        R
                text:
                    12.3R11.2
        master:
            RE0
        model:
            EX4200-48T
        model_info:
            ----------
            fpc0:
                EX4200-48T
        personality:
            SWITCH
        re_info:
            ----------
            default:
                ----------
                0:
                    ----------
                    last_reboot_reason:
                        0x2:watchdog
                    mastership_state:
                        master
                    model:
                        EX4200-48T, 8 POE
                    status:
                        OK
                default:
                    ----------
                    last_reboot_reason:
                        0x2:watchdog
                    mastership_state:
                        master
                    model:
                        EX4200-48T, 8 POE
                    status:
                        OK
        re_master:
            ----------
            default:
                0
        serialnumber:
            BP0208111225
        srx_cluster:
            None
        srx_cluster_id:
            None
        srx_cluster_redundancy_group:
            None
        switch_style:
            VLAN
        vc_capable:
            True
        vc_fabric:
            False
        vc_master:
            0
        vc_mode:
            Mixed
        version:
            12.3R11.2
        version_RE0:
            None
        version_RE1:
            None
        version_info:
            ----------
            build:
                2
            major:
                - 12
                - 3
            minor:
                11
            type:
                R
        virtual:
            False
    kernel:
        unknown
    kernelrelease:
        proxy
    locale_info:
        ----------
    machine_id:
        98073913196c4a9e8c3911408ea59888
    master:
        192.168.233.17
    mem_total:
        0
    nodename:
        ksator-virtual-machine
    num_gpus:
        0
    os:
        proxy
    os_family:
        junos
    osarch:
        x86_64
    osfinger:
        proxy-proxy
    osfullname:
        proxy
    osrelease:
        proxy
    osrelease_info:
        - proxy
    path:
        /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin
    ps:
        ps -efHww
    pythonexecutable:
        /usr/bin/python
    pythonpath:
        - /usr/local/bin
        - /usr/lib/python2.7
        - /usr/lib/python2.7/plat-x86_64-linux-gnu
        - /usr/lib/python2.7/lib-tk
        - /usr/lib/python2.7/lib-old
        - /usr/lib/python2.7/lib-dynload
        - /home/ksator/.local/lib/python2.7/site-packages
        - /usr/local/lib/python2.7/dist-packages
        - /usr/lib/python2.7/dist-packages
    pythonversion:
        - 2
        - 7
        - 12
        - final
        - 0
    saltpath:
        /usr/local/lib/python2.7/dist-packages/salt
    saltversion:
        2017.7.0-202-g3c8dee0
    saltversioninfo:
        - 2017
        - 7
        - 0
        - 0
    virtual:
        VMware
    zmqversion:
        4.1.6

Return junos_facts grain:

# salt ex4200-7 grains.item junos_facts 
ex4200-7:
    ----------
    junos_facts:
        ----------
        2RE:
            False
        HOME:
            /var/home/remote
        RE0:
            ----------
            last_reboot_reason:
                0x2:watchdog
            mastership_state:
                master
            model:
                EX4200-48T, 8 POE
            status:
                OK
            up_time:
                283 days, 21 hours, 12 minutes, 32 seconds
        RE1:
            None
        RE_hw_mi:
            False
        current_re:
            - master
            - node
            - fwdd
            - member
            - pfem
            - fpc0
            - feb0
            - fpc16
        domain:
            poc-nl.jnpr.net
        fqdn:
            sac.poc-nl.jnpr.net
        hostname:
            sac
        hostname_info:
            ----------
            fpc0:
                sac
        ifd_style:
            SWITCH
        junos_info:
            ----------
            fpc0:
                ----------
                object:
                    ----------
                    build:
                        2
                    major:
                        - 12
                        - 3
                    minor:
                        11
                    type:
                        R
                text:
                    12.3R11.2
        master:
            RE0
        model:
            EX4200-48T
        model_info:
            ----------
            fpc0:
                EX4200-48T
        personality:
            SWITCH
        re_info:
            ----------
            default:
                ----------
                0:
                    ----------
                    last_reboot_reason:
                        0x2:watchdog
                    mastership_state:
                        master
                    model:
                        EX4200-48T, 8 POE
                    status:
                        OK
                default:
                    ----------
                    last_reboot_reason:
                        0x2:watchdog
                    mastership_state:
                        master
                    model:
                        EX4200-48T, 8 POE
                    status:
                        OK
        re_master:
            ----------
            default:
                0
        serialnumber:
            BP0208111225
        srx_cluster:
            None
        srx_cluster_id:
            None
        srx_cluster_redundancy_group:
            None
        switch_style:
            VLAN
        vc_capable:
            True
        vc_fabric:
            False
        vc_master:
            0
        vc_mode:
            Mixed
        version:
            12.3R11.2
        version_RE0:
            None
        version_RE1:
            None
        version_info:
            ----------
            build:
                2
            major:
                - 12
                - 3
            minor:
                11
            type:
                R
        virtual:
            False
Clone this wiki locally