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.

443 lines
11KB

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