Saltstack Official Linux Formula
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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