{% set system = salt['grains.filter_by']({
    'Arch': {
        'pkgs': ['sudo', 'vim', 'wget'],
        'utc': true,
        'user': {},
        'group': {},
        'job': {},
        'limit': {},
        'locale': {},
        'motd': {},
        'env': {},
        'profile': {},
        'proxy': {},
        'repo': {},
        'package': {},
        'autoupdates': {
          'pkgs': []
         },
        'selinux': 'permissive',
        'ca_certs_dir': '/usr/local/share/ca-certificates',
        'ca_certs_bin': 'update-ca-certificates',
        'atop': {
             'enabled': false,
             'interval': '20',
             'autostart': true,
             'logpath': '/var/log/atop',
             'outfile': '/var/log/atop/daily.log'
         },
    },
    'Debian': {
        'pkgs': ['python-apt', 'apt-transport-https', 'libmnl0'],
        'utc': true,
        'user': {},
        'group': {},
        'job': {},
        'limit': {},
        'locale': {},
        'motd': {},
        'env': {},
        'profile': {},
        'proxy': {},
        'repo': {},
        'package': {},
        'autoupdates': {
             'pkgs': ['unattended-upgrades']
         },
        'selinux': 'permissive',
        'ca_certs_dir': '/usr/local/share/ca-certificates',
        'ca_certs_bin': 'update-ca-certificates',
        'atop': {
             'enabled': false,
             'interval': '20',
             'autostart': true,
             'logpath': '/var/log/atop',
             'outfile': '/var/log/atop/daily.log'
         },
    },
    'RedHat': {
        'pkgs': ['policycoreutils', 'policycoreutils-python', 'telnet', 'wget'],
        'utc': true,
        'user': {},
        'group': {},
        'job': {},
        'limit': {},
        'locale': {},
        'motd': {},
        'env': {},
        'profile': {},
        'proxy': {},
        'repo': {},
        'package': {},
        'autoupdates': {
             'pkgs': []
         },
        'selinux': 'permissive',
        'ca_certs_dir': '/etc/pki/ca-trust/source/anchors',
        'ca_certs_bin': 'update-ca-trust extract',
        'atop': {
             'enabled': false,
             'interval': '20',
             'autostart': true,
             'logpath': '/var/log/atop',
             'outfile': '/var/log/atop/daily.log'
         },
    },
}, grain='os_family', merge=salt['pillar.get']('linux:system')) %}

{#    'network_name', #}

{% set interface_params = [
    'gateway',
    'mtu',
    'network',
    'broadcast',
    'master',
    'miimon',
    'ovs_ports',
    'ovs_bridge',
    'mode',
    'port_type',
    'peer',
    'lacp-rate',
    'dns-search',
    'up_cmds',
    'pre_up_cmds',
    'post_up_cmds',
    'down_cmds',
    'pre_down_cmds',
    'post_down_cmds',
    'maxwait',
    'stp',
    'gro',
    'lacp_rate',
    'ad_select',
    'downdelay',
    'updelay',
    'hashing-algorithm',
    'hardware-dma-ring-rx',
    'hwaddr',
    'noifupdown',
] %}

{% set network = salt['grains.filter_by']({
    'Arch': {
        'pkgs': ['wpa_supplicant', 'dhclient', 'wireless_tools', 'ifenslave'],
        'bridge_pkgs': ['bridge-utils'],
        'ovs_pkgs': ['openvswitch-switch'],
        'hostname_file': '/etc/hostname',
        'network_manager': False,
        'systemd': {},
        'interface': {},
        'interface_params': interface_params,
        'bridge': 'none',
        'proxy': {
           'host': 'none',
        },
        'host': {},
        'mine_dns_records': False,
        'dhclient_config': '/etc/dhcp/dhclient.conf',
    },
    'Debian': {
        'pkgs': ['ifenslave'],
        'hostname_file': '/etc/hostname',
        'bridge_pkgs': ['bridge-utils'],
        'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'],
        'dpdk_pkgs': ['dpdk', 'dpdk-dev', 'dpdk-dkms', 'dpdk-igb-uio-dkms', 'dpdk-rte-kni-dkms'],
        'network_manager': False,
        'systemd': {},
        'interface': {},
        'interface_params': interface_params,
        'bridge': 'none',
        'proxy': {
           'host': 'none'
        },
        'host': {},
        'mine_dns_records': False,
        'dhclient_config': '/etc/dhcp/dhclient.conf',
    },
    'RedHat': {
        'pkgs': ['iputils'],
        'bridge_pkgs': ['bridge-utils'],
        'ovs_pkgs': ['openvswitch-switch', 'bridge-utils'],
        'hostname_file': '/etc/sysconfig/network',
        'network_manager': False,
        'systemd': {},
        'interface': {},
        'interface_params': interface_params,
        'bridge': 'none',
        'proxy': {
           'host': 'none'
        },
        'host': {},
        'mine_dns_records': False,
        'dhclient_config': '/etc/dhcp/dhclient.conf',
    },
}, grain='os_family', merge=salt['pillar.get']('linux:network')) %}

{% set storage = salt['grains.filter_by']({
    'Arch': {
        'mount': {},
        'swap': {},
        'disk': {},
        'lvm': {},
        'lvm_services': ['lvm2-lvmetad', 'lvm2-lvmpolld', 'lvm2-monitor'],
        'loopback': {},
        'nfs': {
             'pkgs': ['nfs-utils']
         },
        'multipath': {
             'enabled': False,
             'pkgs': ['multipath-tools', 'multipath-tools-boot'],
             'service': ''
         },
    },
    'Debian': {
        'mount': {},
        'swap': {},
        'lvm': {},
        'disk': {},
        'lvm_services': ['lvm2-lvmetad', 'lvm2-lvmpolld', 'lvm2-monitor'],
        'loopback': {},
        'nfs': {
             'pkgs': ['nfs-common']
         },
        'multipath': {
             'enabled': False,
             'pkgs': ['multipath-tools', 'multipath-tools-boot'],
             'service': 'multipath-tools'
         },
        'lvm_pkgs': ['lvm2'],
    },
    'RedHat': {
        'mount': {},
        'swap': {},
        'lvm': {},
        'disk': {},
        'lvm_services': ['lvm2-lvmetad', 'lvm2-lvmpolld', 'lvm2-monitor'],
        'loopback': {},
        'nfs': {
             'pkgs': ['nfs-utils']
         },
        'multipath': {
             'enabled': False,
             'pkgs': [],
             'service': 'multipath'
         },
    },
}, grain='os_family', merge=salt['pillar.get']('linux:storage')) %}


{% set monitoring = salt['grains.filter_by']({
    'default': {
        'zombie': {
            'warn': 3,
            'crit': 7,
        },
        'procs': {
            'warn': 5000,
            'crit': 10000,
        },
        'load': {
            'warn': '6,4,2',
            'crit': '12,8,4',
        },
        'swap': {
            'warn': '50%',
            'crit': '20%',
        },
        'disk': {
            'warn': '15%',
            'crit': '5%',
        },
        'netlink': {
            'interfaces': [],
            'interface_regex': '^[a-z0-9]+$',
            'ignore_selected': False,
        },
        'bond_status': {
            'interfaces': False
        },
        'cpu_idle_percentage': {
              'warn': 10.0,
        },
        'free_memory_percentage': {
              'warn': 10.0,
              'crit': 5.0,
        },
        'load_5': {
              'warn': 3,
        },
        'rx_packets_dropped_rate': {
              'warn': 100,
        },
        'tx_packets_dropped_rate': {
              'warn': 100,
        },
        'swap_in_rate': {
              'warn': 1024 * 1024,
        },
        'swap_out_rate': {
              'warn': 1024 * 1024,
        },
    },
}, grain='os_family', merge=salt['pillar.get']('linux:monitoring')) %}