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.

473 lines
12KB

  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. 'at': {
  30. 'pkgs': [],
  31. 'services': []
  32. },
  33. 'cron': {
  34. 'pkgs': [],
  35. 'services': []
  36. },
  37. },
  38. 'Debian': {
  39. 'pkgs': ['python-apt', 'apt-transport-https', 'libmnl0'],
  40. 'utc': true,
  41. 'user': {},
  42. 'group': {},
  43. 'job': {},
  44. 'limit': {},
  45. 'locale': {},
  46. 'motd': {},
  47. 'env': {},
  48. 'profile': {},
  49. 'proxy': {},
  50. 'repo': {},
  51. 'package': {},
  52. 'autoupdates': {
  53. 'pkgs': ['unattended-upgrades']
  54. },
  55. 'selinux': 'permissive',
  56. 'ca_certs_dir': '/usr/local/share/ca-certificates',
  57. 'ca_certs_bin': 'update-ca-certificates',
  58. 'atop': {
  59. 'enabled': false,
  60. 'interval': '20',
  61. 'autostart': true,
  62. 'logpath': '/var/log/atop',
  63. 'outfile': '/var/log/atop/daily.log'
  64. },
  65. 'at': {
  66. 'pkgs': ['at'],
  67. 'services': ['atd'],
  68. 'user': {}
  69. },
  70. 'cron': {
  71. 'pkgs': ['cron'],
  72. 'services': ['cron'],
  73. 'user': {}
  74. },
  75. },
  76. 'RedHat': {
  77. 'pkgs': ['policycoreutils', 'policycoreutils-python', 'telnet', 'wget'],
  78. 'utc': true,
  79. 'user': {},
  80. 'group': {},
  81. 'job': {},
  82. 'limit': {},
  83. 'locale': {},
  84. 'motd': {},
  85. 'env': {},
  86. 'profile': {},
  87. 'proxy': {},
  88. 'repo': {},
  89. 'package': {},
  90. 'autoupdates': {
  91. 'pkgs': []
  92. },
  93. 'selinux': 'permissive',
  94. 'ca_certs_dir': '/etc/pki/ca-trust/source/anchors',
  95. 'ca_certs_bin': 'update-ca-trust extract',
  96. 'atop': {
  97. 'enabled': false,
  98. 'interval': '20',
  99. 'autostart': true,
  100. 'logpath': '/var/log/atop',
  101. 'outfile': '/var/log/atop/daily.log'
  102. },
  103. 'at': {
  104. 'pkgs': [],
  105. 'services': []
  106. },
  107. 'cron': {
  108. 'pkgs': [],
  109. 'services': []
  110. },
  111. },
  112. }, grain='os_family', merge=salt['pillar.get']('linux:system')) %}
  113. {% set banner = salt['grains.filter_by']({
  114. 'BaseDefaults': {
  115. 'enabled': false,
  116. },
  117. }, grain='os_family', merge=salt['pillar.get']('linux:system:banner'), base='BaseDefaults') %}
  118. {% set auth = salt['grains.filter_by']({
  119. 'Arch': {
  120. 'enabled': false,
  121. 'duo': {
  122. 'enabled': false,
  123. 'duo_host': 'localhost',
  124. 'duo_ikey': '',
  125. 'duo_skey': ''
  126. }
  127. },
  128. 'RedHat': {
  129. 'enabled': false,
  130. 'duo': {
  131. 'enabled': false,
  132. 'duo_host': 'localhost',
  133. 'duo_ikey': '',
  134. 'duo_skey': ''
  135. }
  136. },
  137. 'Debian': {
  138. 'enabled': false,
  139. 'duo': {
  140. 'enabled': false,
  141. 'duo_host': 'localhost',
  142. 'duo_ikey': '',
  143. 'duo_skey': ''
  144. }
  145. },
  146. }, grain='os_family', merge=salt['pillar.get']('linux:system:auth')) %}
  147. {% set ldap = salt['grains.filter_by']({
  148. 'RedHat': {
  149. 'enabled': false,
  150. 'pkgs': ['openldap-clients', 'nss-pam-ldapd', 'authconfig', 'nscd'],
  151. 'version': '3',
  152. 'scope': 'sub',
  153. 'uid': 'nslcd',
  154. 'gid': 'nslcd',
  155. },
  156. 'Debian': {
  157. 'enabled': false,
  158. 'pkgs': ['libnss-ldapd', 'libpam-ldapd', 'nscd'],
  159. 'version': '3',
  160. 'scope': 'sub',
  161. 'uid': 'nslcd',
  162. 'gid': 'nslcd',
  163. },
  164. }, grain='os_family', merge=salt['pillar.get']('linux:system:auth:ldap')) %}
  165. {%- load_yaml as login_defs_defaults %}
  166. Debian:
  167. CHFN_RESTRICT:
  168. value: 'rwh'
  169. DEFAULT_HOME:
  170. value: 'yes'
  171. ENCRYPT_METHOD:
  172. value: 'SHA512'
  173. ENV_PATH:
  174. value: 'PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games'
  175. ENV_SUPATH:
  176. value: 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
  177. ERASECHAR:
  178. value: '0177'
  179. FAILLOG_ENAB:
  180. value: 'yes'
  181. FTMP_FILE:
  182. value: '/var/log/btmp'
  183. GID_MAX:
  184. value: '60000'
  185. GID_MIN:
  186. value: '1000'
  187. HUSHLOGIN_FILE:
  188. value: '.hushlogin'
  189. KILLCHAR:
  190. value: '025'
  191. LOGIN_RETRIES:
  192. value: '5'
  193. LOGIN_TIMEOUT:
  194. value: '60'
  195. LOG_OK_LOGINS:
  196. value: 'no'
  197. LOG_UNKFAIL_ENAB:
  198. value: 'no'
  199. MAIL_DIR:
  200. value: '/var/mail'
  201. PASS_MAX_DAYS:
  202. value: '99999'
  203. PASS_MIN_DAYS:
  204. value: '0'
  205. PASS_WARN_AGE:
  206. value: '7'
  207. SU_NAME:
  208. value: 'su'
  209. SYSLOG_SG_ENAB:
  210. value: 'yes'
  211. SYSLOG_SU_ENAB:
  212. value: 'yes'
  213. TTYGROUP:
  214. value: 'tty'
  215. TTYPERM:
  216. value: '0600'
  217. UID_MAX:
  218. value: '60000'
  219. UID_MIN:
  220. value: '1000'
  221. UMASK:
  222. value: '022'
  223. USERGROUPS_ENAB:
  224. value: 'yes'
  225. {%- endload %}
  226. {%- set login_defs = salt['grains.filter_by'](login_defs_defaults,
  227. grain='os_family', merge=salt['pillar.get']('linux:system:login_defs')) %}
  228. {# 'network_name', #}
  229. {% set interface_params = [
  230. 'gateway',
  231. 'mtu',
  232. 'network',
  233. 'broadcast',
  234. 'master',
  235. 'miimon',
  236. 'ovs_ports',
  237. 'ovs_bridge',
  238. 'mode',
  239. 'port_type',
  240. 'peer',
  241. 'lacp-rate',
  242. 'dns-search',
  243. 'up_cmds',
  244. 'pre_up_cmds',
  245. 'post_up_cmds',
  246. 'down_cmds',
  247. 'pre_down_cmds',
  248. 'post_down_cmds',
  249. 'maxwait',
  250. 'stp',
  251. 'gro',
  252. 'rx',
  253. 'tx',
  254. 'sg',
  255. 'tso',
  256. 'ufo',
  257. 'gso',
  258. 'lro',
  259. 'lacp_rate',
  260. 'ad_select',
  261. 'downdelay',
  262. 'updelay',
  263. 'hashing-algorithm',
  264. 'hardware-dma-ring-rx',
  265. 'hwaddr',
  266. 'noifupdown',
  267. 'arp_ip_target',
  268. 'primary',
  269. ] %}
  270. {% set debian_headers = "linux-headers-" + grains.get('kernelrelease')|string %}
  271. {% set network = salt['grains.filter_by']({
  272. 'Arch': {
  273. 'pkgs': ['wpa_supplicant', 'dhclient', 'wireless_tools', 'ifenslave'],
  274. 'bridge_pkgs': ['bridge-utils', 'vlan'],
  275. 'ovs_pkgs': ['openvswitch-switch', 'vlan'],
  276. 'hostname_file': '/etc/hostname',
  277. 'network_manager': False,
  278. 'systemd': {},
  279. 'interface': {},
  280. 'interface_params': interface_params,
  281. 'bridge': 'none',
  282. 'proxy': {
  283. 'host': 'none',
  284. },
  285. 'host': {},
  286. 'mine_dns_records': False,
  287. 'dhclient_config': '/etc/dhcp/dhclient.conf',
  288. 'ovs_nowait': False,
  289. },
  290. 'Debian': {
  291. 'pkgs': ['ifenslave'],
  292. 'hostname_file': '/etc/hostname',
  293. 'bridge_pkgs': ['bridge-utils', 'vlan'],
  294. 'ovs_pkgs': ['openvswitch-switch', 'bridge-utils', 'vlan'],
  295. 'dpdk_pkgs': ['dpdk', 'dpdk-dev', 'dpdk-igb-uio-dkms', 'dpdk-rte-kni-dkms', debian_headers.encode('utf8') ],
  296. 'network_manager': False,
  297. 'systemd': {},
  298. 'interface': {},
  299. 'interface_params': interface_params,
  300. 'bridge': 'none',
  301. 'proxy': {
  302. 'host': 'none'
  303. },
  304. 'host': {},
  305. 'mine_dns_records': False,
  306. 'dhclient_config': '/etc/dhcp/dhclient.conf',
  307. 'ovs_nowait': False,
  308. },
  309. 'RedHat': {
  310. 'pkgs': ['iputils'],
  311. 'bridge_pkgs': ['bridge-utils', 'vlan'],
  312. 'ovs_pkgs': ['openvswitch-switch', 'bridge-utils', 'vlan'],
  313. 'hostname_file': '/etc/sysconfig/network',
  314. 'network_manager': False,
  315. 'systemd': {},
  316. 'interface': {},
  317. 'interface_params': interface_params,
  318. 'bridge': 'none',
  319. 'proxy': {
  320. 'host': 'none'
  321. },
  322. 'host': {},
  323. 'mine_dns_records': False,
  324. 'dhclient_config': '/etc/dhcp/dhclient.conf',
  325. 'ovs_nowait': False,
  326. },
  327. }, grain='os_family', merge=salt['pillar.get']('linux:network')) %}
  328. {% set storage = salt['grains.filter_by']({
  329. 'Arch': {
  330. 'mount': {},
  331. 'swap': {},
  332. 'disk': {},
  333. 'lvm': {},
  334. 'lvm_services': ['lvm2-lvmetad', 'lvm2-lvmpolld', 'lvm2-monitor'],
  335. 'loopback': {},
  336. 'nfs': {
  337. 'pkgs': ['nfs-utils']
  338. },
  339. 'multipath': {
  340. 'enabled': False,
  341. 'pkgs': ['multipath-tools', 'multipath-tools-boot'],
  342. 'service': ''
  343. },
  344. },
  345. 'Debian': {
  346. 'mount': {},
  347. 'swap': {},
  348. 'lvm': {},
  349. 'disk': {},
  350. 'lvm_services': ['lvm2-lvmetad', 'lvm2-lvmpolld', 'lvm2-monitor'],
  351. 'loopback': {},
  352. 'nfs': {
  353. 'pkgs': ['nfs-common']
  354. },
  355. 'multipath': {
  356. 'enabled': False,
  357. 'pkgs': ['multipath-tools', 'multipath-tools-boot'],
  358. 'service': 'multipath-tools'
  359. },
  360. 'lvm_pkgs': ['lvm2'],
  361. },
  362. 'RedHat': {
  363. 'mount': {},
  364. 'swap': {},
  365. 'lvm': {},
  366. 'disk': {},
  367. 'lvm_services': ['lvm2-lvmetad', 'lvm2-lvmpolld', 'lvm2-monitor'],
  368. 'loopback': {},
  369. 'nfs': {
  370. 'pkgs': ['nfs-utils']
  371. },
  372. 'multipath': {
  373. 'enabled': False,
  374. 'pkgs': [],
  375. 'service': 'multipath'
  376. },
  377. },
  378. }, merge=salt['grains.filter_by']({
  379. 'buster': {
  380. 'lvm_services': ['lvm2-monitor'],
  381. },
  382. 'trusty': {
  383. 'lvm_services': ['udev'],
  384. },
  385. }, grain='oscodename', merge=salt['pillar.get']('linux:storage'))) %}
  386. {% set monitoring = salt['grains.filter_by']({
  387. 'default': {
  388. 'bond_status': {
  389. 'interfaces': False
  390. },
  391. 'zombie': {
  392. 'warn': 3,
  393. 'crit': 7,
  394. },
  395. 'procs': {
  396. 'warn': 5000,
  397. 'crit': 10000,
  398. },
  399. 'load': {
  400. 'warn': '6,4,2',
  401. 'crit': '12,8,4',
  402. },
  403. 'swap': {
  404. 'warn': '50%',
  405. 'crit': '20%',
  406. },
  407. 'disk': {
  408. 'warn': '15%',
  409. 'crit': '5%',
  410. },
  411. 'netlink': {
  412. 'interfaces': [],
  413. 'interface_regex': '^[a-z0-9]+$',
  414. 'ignore_selected': False,
  415. },
  416. 'cpu_usage_percentage': {
  417. 'warn': 90.0,
  418. },
  419. 'memory_usage_percentage': {
  420. 'warn': 90.0,
  421. 'major': 95.0,
  422. },
  423. 'disk_usage_percentage': {
  424. 'warn': 85.0,
  425. 'major': 95.0,
  426. },
  427. 'swap_usage_percentage': {
  428. 'warn': 50.0,
  429. 'minor': 90.0,
  430. },
  431. 'inodes_usage_percentage': {
  432. 'warn': 85.0,
  433. 'major': 95.0,
  434. },
  435. 'system_load_threshold': {
  436. 'warn': 1,
  437. 'crit': 2,
  438. },
  439. 'rx_packets_dropped_threshold': {
  440. 'warn': 100,
  441. },
  442. 'tx_packets_dropped_threshold': {
  443. 'warn': 100,
  444. },
  445. 'swap_in_rate': {
  446. 'warn': 1024 * 1024,
  447. },
  448. 'swap_out_rate': {
  449. 'warn': 1024 * 1024,
  450. },
  451. 'failed_auths_threshold': {
  452. 'warn': 5,
  453. },
  454. 'net_rx_action_per_cpu_threshold': {
  455. 'warning': '500',
  456. 'minor': '5000'
  457. },
  458. 'packets_dropped_per_cpu_threshold': {
  459. 'minor': '0',
  460. 'major': '100'
  461. }
  462. },
  463. }, grain='os_family', merge=salt['pillar.get']('linux:monitoring')) %}