Saltstack Official Apache 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.

128 lines
4.0KB

  1. {% import_yaml "apache/osfingermap.yaml" as osfingermap %}
  2. {% import_yaml "apache/modsecurity.yaml" as modsec %}
  3. {% set apache = salt['grains.filter_by']({
  4. 'Debian': {
  5. 'server': 'apache2',
  6. 'service': 'apache2',
  7. 'configfile': '/etc/apache2/apache2.conf',
  8. 'portsfile': '/etc/apache2/ports.conf',
  9. 'mod_wsgi': 'libapache2-mod-wsgi',
  10. 'mod_php5': 'libapache2-mod-php5',
  11. 'mod_fcgid': 'libapache2-mod-fcgid',
  12. 'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb',
  13. 'vhostdir': '/etc/apache2/sites-available',
  14. 'confdir': '/etc/apache2/conf.d',
  15. 'confext': '.conf',
  16. 'default_site': 'default',
  17. 'default_site_ssl': 'default-ssl',
  18. 'logdir': '/var/log/apache2',
  19. 'logrotatedir': '/etc/logrotate.d/apache2',
  20. 'wwwdir': '/srv',
  21. 'use_require': False,
  22. },
  23. 'RedHat': {
  24. 'server': 'httpd',
  25. 'service': 'httpd',
  26. 'configfile': '/etc/httpd/conf/httpd.conf',
  27. 'mod_wsgi': 'mod_wsgi',
  28. 'mod_php5': 'php',
  29. 'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm',
  30. 'vhostdir': '/etc/httpd/vhosts.d',
  31. 'confdir': '/etc/httpd/conf.d',
  32. 'confext': '.conf',
  33. 'default_site': 'default',
  34. 'default_site_ssl': 'default-ssl',
  35. 'logdir': '/var/log/httpd',
  36. 'logrotatedir': '/etc/logrotate.d/httpd',
  37. 'wwwdir': '/var/www',
  38. 'use_require': False,
  39. },
  40. 'Suse': {
  41. 'server': 'apache2',
  42. 'service': 'apache2',
  43. 'configfile': '/etc/apache2/httpd.conf',
  44. 'mod_wsgi': 'apache2-mod_wsgi',
  45. 'mod_php5': 'apache2-mod_php5',
  46. 'mod_fcgid': 'apache2-mod_fcgid',
  47. 'vhostdir': '/etc/apache2/vhosts.d',
  48. 'confdir': '/etc/httpd/conf.d',
  49. 'confext': '.conf',
  50. 'default_site': 'vhost.template',
  51. 'default_site_ssl': 'vhost-ssl.template',
  52. 'logdir': '/var/log/apache2',
  53. 'wwwdir': '/srv/www',
  54. 'use_require': True,
  55. },
  56. 'FreeBSD': {
  57. 'server': 'apache22',
  58. 'service': 'apache22',
  59. 'configfile': '/usr/local/etc/apache22/httpd.conf',
  60. 'mod_wsgi': 'ap22-mod_wsgi3',
  61. 'vhostdir': '/usr/local/etc/apache22/Includes',
  62. 'confdir': '/usr/local/etc/apache22/Includes',
  63. 'confext': '',
  64. 'default_site': 'default',
  65. 'default_site_ssl': 'default-ssl',
  66. 'logdir': '/var/log/',
  67. 'wwwdir': '/usr/local/www/apache22/',
  68. 'use_require': False,
  69. },
  70. }, merge=salt['grains.filter_by']({
  71. 'precise': {
  72. 'confext': '',
  73. 'default_site': 'default',
  74. 'default_site_ssl': 'default-ssl',
  75. 'use_require': True,
  76. },
  77. 'trusty': {
  78. 'confext': '.conf',
  79. 'default_site': '000-default.conf',
  80. 'default_site_ssl': 'default-ssl.conf',
  81. 'use_require': True,
  82. },
  83. 'utopic': {
  84. 'confext': '.conf',
  85. 'default_site': '000-default.conf',
  86. 'default_site_ssl': 'default-ssl.conf',
  87. 'use_require': True,
  88. },
  89. 'vivid': {
  90. 'confext': '.conf',
  91. 'default_site': '000-default.conf',
  92. 'default_site_ssl': 'default-ssl.conf',
  93. 'use_require': True,
  94. },
  95. 'wily': {
  96. 'confext': '.conf',
  97. 'default_site': '000-default.conf',
  98. 'default_site_ssl': 'default-ssl.conf',
  99. 'use_require': True,
  100. },
  101. 'jessie': {
  102. 'wwwdir': '/var/www',
  103. 'confext': '.conf',
  104. 'default_site': '000-default.conf',
  105. 'default_site_ssl': 'default-ssl.conf',
  106. 'use_require': True,
  107. },
  108. }, grain='oscodename', merge=salt['grains.filter_by'](
  109. osfingermap
  110. , grain='osfinger', merge=salt['pillar.get']('apache:lookup')))) %}
  111. {% set modsecurity = salt['grains.filter_by'](
  112. modsec
  113. , grain='os_family', merge=salt['pillar.get']('apache:mod_security')) or {} %}
  114. {# merge the os family/codename mod_sec's specific data over the defaults #}
  115. {% do apache.update({ 'mod_security': modsecurity }) %}