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.

160 lines
5.1KB

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