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.

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