Saltstack Official Linux Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

379 lines
9.7KB

  1. {% set system = salt['grains.filter_by']({
  2. 'Arch': {
  3. 'pkgs': ['sudo', 'vim', 'wget'],
  4. 'utc': true,
  5. 'user': {},
  6. 'group': {},
  7. 'job': {},
  8. 'limit': {},
  9. 'locale': {},
  10. 'motd': {},
  11. 'env': {},
  12. 'profile': {},
  13. 'proxy': {},
  14. 'repo': {},
  15. 'package': {},
  16. 'autoupdates': {
  17. 'pkgs': []
  18. },
  19. 'selinux': 'permissive',
  20. 'ca_certs_dir': '/usr/local/share/ca-certificates',
  21. 'ca_certs_bin': 'update-ca-certificates',
  22. 'atop': {
  23. 'enabled': false,
  24. 'interval': '20',
  25. 'autostart': true,
  26. 'logpath': '/var/log/atop',
  27. 'outfile': '/var/log/atop/daily.log'
  28. },
  29. },
  30. 'Debian': {
  31. 'pkgs': ['python-apt', 'apt-transport-https', 'libmnl0'],
  32. 'utc': true,
  33. 'user': {},
  34. 'group': {},
  35. 'job': {},
  36. 'limit': {},
  37. 'locale': {},
  38. 'motd': {},
  39. 'env': {},
  40. 'profile': {},
  41. 'proxy': {},
  42. 'repo': {},
  43. 'package': {},
  44. 'autoupdates': {
  45. 'pkgs': ['unattended-upgrades']
  46. },
  47. 'selinux': 'permissive',
  48. 'ca_certs_dir': '/usr/local/share/ca-certificates',
  49. 'ca_certs_bin': 'update-ca-certificates',
  50. 'atop': {
  51. 'enabled': false,
  52. 'interval': '20',
  53. 'autostart': true,
  54. 'logpath': '/var/log/atop',
  55. 'outfile': '/var/log/atop/daily.log'
  56. },
  57. },
  58. 'RedHat': {
  59. 'pkgs': ['policycoreutils', 'policycoreutils-python', 'telnet', 'wget'],
  60. 'utc': true,
  61. 'user': {},
  62. 'group': {},
  63. 'job': {},
  64. 'limit': {},
  65. 'locale': {},
  66. 'motd': {},
  67. 'env': {},
  68. 'profile': {},
  69. 'proxy': {},
  70. 'repo': {},
  71. 'package': {},
  72. 'autoupdates': {
  73. 'pkgs': []
  74. },
  75. 'selinux': 'permissive',
  76. 'ca_certs_dir': '/etc/pki/ca-trust/source/anchors',
  77. 'ca_certs_bin': 'update-ca-trust extract',
  78. 'atop': {
  79. 'enabled': false,
  80. 'interval': '20',
  81. 'autostart': true,
  82. 'logpath': '/var/log/atop',
  83. 'outfile': '/var/log/atop/daily.log'
  84. },
  85. },
  86. }, grain='os_family', merge=salt['pillar.get']('linux:system')) %}
  87. {% set at = salt['grains.filter_by']({
  88. 'Debian': {
  89. 'enabled': false,
  90. 'pkgs': ['at'],
  91. 'services': ['atd'],
  92. 'user': {}
  93. },
  94. }, grain='os_family', merge=salt['pillar.get']('linux:system:at')) %}
  95. {% set cron = salt['grains.filter_by']({
  96. 'Debian': {
  97. 'enabled': false,
  98. 'pkgs': ['cron'],
  99. 'services': ['cron'],
  100. 'user': {}
  101. },
  102. }, grain='os_family', merge=salt['pillar.get']('linux:system:cron')) %}
  103. {% set banner = salt['grains.filter_by']({
  104. 'BaseDefaults': {
  105. 'enabled': false,
  106. },
  107. }, grain='os_family', merge=salt['pillar.get']('linux:system:banner'), base='BaseDefaults') %}
  108. {% set auth = salt['grains.filter_by']({
  109. 'Arch': {
  110. 'enabled': false,
  111. },
  112. 'RedHat': {
  113. 'enabled': false,
  114. },
  115. 'Debian': {
  116. 'enabled': false,
  117. },
  118. }, grain='os_family', merge=salt['pillar.get']('linux:system:auth')) %}
  119. {% set ldap = salt['grains.filter_by']({
  120. 'RedHat': {
  121. 'enabled': false,
  122. 'pkgs': ['openldap-clients', 'nss-pam-ldapd', 'authconfig', 'nscd'],
  123. 'version': '3',
  124. 'scope': 'sub',
  125. 'uid': 'nslcd',
  126. 'gid': 'nslcd',
  127. },
  128. 'Debian': {
  129. 'enabled': false,
  130. 'pkgs': ['libnss-ldapd', 'libpam-ldapd', 'nscd'],
  131. 'version': '3',
  132. 'scope': 'sub',
  133. 'uid': 'nslcd',
  134. 'gid': 'nslcd',
  135. },
  136. }, grain='os_family', merge=salt['pillar.get']('linux:system:auth:ldap')) %}
  137. {# 'network_name', #}
  138. {% set interface_params = [
  139. 'gateway',
  140. 'mtu',
  141. 'network',
  142. 'broadcast',
  143. 'master',
  144. 'miimon',
  145. 'ovs_ports',
  146. 'ovs_bridge',
  147. 'mode',
  148. 'port_type',
  149. 'peer',
  150. 'lacp-rate',
  151. 'dns-search',
  152. 'up_cmds',
  153. 'pre_up_cmds',
  154. 'post_up_cmds',
  155. 'down_cmds',
  156. 'pre_down_cmds',
  157. 'post_down_cmds',
  158. 'maxwait',
  159. 'stp',
  160. 'gro',
  161. 'rx',
  162. 'tx',
  163. 'sg',
  164. 'tso',
  165. 'ufo',
  166. 'gso',
  167. 'lro',
  168. 'lacp_rate',
  169. 'ad_select',
  170. 'downdelay',
  171. 'updelay',
  172. 'hashing-algorithm',
  173. 'hardware-dma-ring-rx',
  174. 'hwaddr',
  175. 'noifupdown',
  176. 'arp_ip_target',
  177. 'primary',
  178. ] %}
  179. {% set debian_headers = "linux-headers-" + grains.get('kernelrelease')|string %}
  180. {% set network = salt['grains.filter_by']({
  181. 'Arch': {
  182. 'pkgs': ['wpa_supplicant', 'dhclient', 'wireless_tools', 'ifenslave'],
  183. 'bridge_pkgs': ['bridge-utils', 'vlan'],
  184. 'ovs_pkgs': ['openvswitch-switch', 'vlan'],
  185. 'hostname_file': '/etc/hostname',
  186. 'network_manager': False,
  187. 'systemd': {},
  188. 'interface': {},
  189. 'interface_params': interface_params,
  190. 'bridge': 'none',
  191. 'proxy': {
  192. 'host': 'none',
  193. },
  194. 'host': {},
  195. 'mine_dns_records': False,
  196. 'dhclient_config': '/etc/dhcp/dhclient.conf',
  197. 'ovs_nowait': False,
  198. },
  199. 'Debian': {
  200. 'pkgs': ['ifenslave'],
  201. 'hostname_file': '/etc/hostname',
  202. 'bridge_pkgs': ['bridge-utils', 'vlan'],
  203. 'ovs_pkgs': ['openvswitch-switch', 'bridge-utils', 'vlan'],
  204. 'dpdk_pkgs': ['dpdk', 'dpdk-dev', 'dpdk-igb-uio-dkms', 'dpdk-rte-kni-dkms', debian_headers.encode('utf8') ],
  205. 'network_manager': False,
  206. 'systemd': {},
  207. 'interface': {},
  208. 'interface_params': interface_params,
  209. 'bridge': 'none',
  210. 'proxy': {
  211. 'host': 'none'
  212. },
  213. 'host': {},
  214. 'mine_dns_records': False,
  215. 'dhclient_config': '/etc/dhcp/dhclient.conf',
  216. 'ovs_nowait': False,
  217. },
  218. 'RedHat': {
  219. 'pkgs': ['iputils'],
  220. 'bridge_pkgs': ['bridge-utils', 'vlan'],
  221. 'ovs_pkgs': ['openvswitch-switch', 'bridge-utils', 'vlan'],
  222. 'hostname_file': '/etc/sysconfig/network',
  223. 'network_manager': False,
  224. 'systemd': {},
  225. 'interface': {},
  226. 'interface_params': interface_params,
  227. 'bridge': 'none',
  228. 'proxy': {
  229. 'host': 'none'
  230. },
  231. 'host': {},
  232. 'mine_dns_records': False,
  233. 'dhclient_config': '/etc/dhcp/dhclient.conf',
  234. 'ovs_nowait': False,
  235. },
  236. }, grain='os_family', merge=salt['pillar.get']('linux:network')) %}
  237. {% set storage = salt['grains.filter_by']({
  238. 'Arch': {
  239. 'mount': {},
  240. 'swap': {},
  241. 'disk': {},
  242. 'lvm': {},
  243. 'lvm_services': ['lvm2-lvmetad', 'lvm2-lvmpolld', 'lvm2-monitor'],
  244. 'loopback': {},
  245. 'nfs': {
  246. 'pkgs': ['nfs-utils']
  247. },
  248. 'multipath': {
  249. 'enabled': False,
  250. 'pkgs': ['multipath-tools', 'multipath-tools-boot'],
  251. 'service': ''
  252. },
  253. },
  254. 'Debian': {
  255. 'mount': {},
  256. 'swap': {},
  257. 'lvm': {},
  258. 'disk': {},
  259. 'lvm_services': ['lvm2-lvmetad', 'lvm2-lvmpolld', 'lvm2-monitor'],
  260. 'loopback': {},
  261. 'nfs': {
  262. 'pkgs': ['nfs-common']
  263. },
  264. 'multipath': {
  265. 'enabled': False,
  266. 'pkgs': ['multipath-tools', 'multipath-tools-boot'],
  267. 'service': 'multipath-tools'
  268. },
  269. 'lvm_pkgs': ['lvm2'],
  270. },
  271. 'RedHat': {
  272. 'mount': {},
  273. 'swap': {},
  274. 'lvm': {},
  275. 'disk': {},
  276. 'lvm_services': ['lvm2-lvmetad', 'lvm2-lvmpolld', 'lvm2-monitor'],
  277. 'loopback': {},
  278. 'nfs': {
  279. 'pkgs': ['nfs-utils']
  280. },
  281. 'multipath': {
  282. 'enabled': False,
  283. 'pkgs': [],
  284. 'service': 'multipath'
  285. },
  286. },
  287. }, merge=salt['grains.filter_by']({
  288. 'trusty': {
  289. 'lvm_services': ['udev'],
  290. },
  291. }, grain='oscodename', merge=salt['pillar.get']('linux:storage'))) %}
  292. {% set monitoring = salt['grains.filter_by']({
  293. 'default': {
  294. 'bond_status': {
  295. 'interfaces': False
  296. },
  297. 'zombie': {
  298. 'warn': 3,
  299. 'crit': 7,
  300. },
  301. 'procs': {
  302. 'warn': 5000,
  303. 'crit': 10000,
  304. },
  305. 'load': {
  306. 'warn': '6,4,2',
  307. 'crit': '12,8,4',
  308. },
  309. 'swap': {
  310. 'warn': '50%',
  311. 'crit': '20%',
  312. },
  313. 'disk': {
  314. 'warn': '15%',
  315. 'crit': '5%',
  316. },
  317. 'netlink': {
  318. 'interfaces': [],
  319. 'interface_regex': '^[a-z0-9]+$',
  320. 'ignore_selected': False,
  321. },
  322. 'cpu_usage_percentage': {
  323. 'warn': 90.0,
  324. },
  325. 'memory_usage_percentage': {
  326. 'warn': 90.0,
  327. 'major': 95.0,
  328. },
  329. 'disk_usage_percentage': {
  330. 'warn': 85.0,
  331. 'major': 95.0,
  332. },
  333. 'swap_usage_percentage': {
  334. 'warn': 50.0,
  335. 'minor': 90.0,
  336. },
  337. 'inodes_usage_percentage': {
  338. 'warn': 85.0,
  339. 'major': 95.0,
  340. },
  341. 'system_load_threshold': {
  342. 'warn': 1,
  343. 'crit': 2,
  344. },
  345. 'rx_packets_dropped_threshold': {
  346. 'warn': 100,
  347. },
  348. 'tx_packets_dropped_threshold': {
  349. 'warn': 100,
  350. },
  351. 'swap_in_rate': {
  352. 'warn': 1024 * 1024,
  353. },
  354. 'swap_out_rate': {
  355. 'warn': 1024 * 1024,
  356. },
  357. 'failed_auths_threshold': {
  358. 'warn': 5,
  359. },
  360. 'net_rx_action_per_cpu_threshold': {
  361. 'warning': '0',
  362. 'minor': '100'
  363. },
  364. 'packets_dropped_per_cpu_threshold': {
  365. 'minor': '0',
  366. 'major': '100'
  367. }
  368. },
  369. }, grain='os_family', merge=salt['pillar.get']('linux:monitoring')) %}