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.

207 lines
6.5KB

  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. 'user': 'apache',
  8. 'group': 'apache',
  9. 'configfile': '/etc/apache2/httpd.conf',
  10. 'mod_wsgi': 'www-apache/mod_wsgi',
  11. 'mod_fcgid': 'www-apache/mod_fcgid',
  12. 'vhostdir': '/etc/apache2/vhosts.d',
  13. 'confdir': '/etc/conf.d/apache2',
  14. 'confext': '.conf',
  15. 'default_site': 'default',
  16. 'default_site_ssl': 'default-ssl',
  17. 'logdir': '/var/log/apache2',
  18. 'logrotatedir': '/etc/logrotate.d/apache2',
  19. 'wwwdir': '/var/www',
  20. },
  21. 'Debian': {
  22. 'server': 'apache2',
  23. 'service': 'apache2',
  24. 'user': 'www-data',
  25. 'group': 'www-data',
  26. 'configfile': '/etc/apache2/apache2.conf',
  27. 'portsfile': '/etc/apache2/ports.conf',
  28. 'mod_wsgi': 'libapache2-mod-wsgi',
  29. 'mod_php5': 'libapache2-mod-php5',
  30. 'mod_perl2': 'libapache2-mod-perl2',
  31. 'mod_fcgid': 'libapache2-mod-fcgid',
  32. 'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb',
  33. 'mod_xsendfile': 'libapache2-mod-xsendfile',
  34. 'mod_fastcgi': 'libapache2-mod-fastcgi',
  35. 'vhostdir': '/etc/apache2/sites-available',
  36. 'confdir': '/etc/apache2/conf-available',
  37. 'confext': '.conf',
  38. 'default_site': 'default',
  39. 'default_site_ssl': 'default-ssl',
  40. 'logdir': '/var/log/apache2',
  41. 'logrotatedir': '/etc/logrotate.d/apache2',
  42. 'wwwdir': '/srv',
  43. },
  44. 'RedHat': {
  45. 'server': 'httpd',
  46. 'service': 'httpd',
  47. 'user': 'apache',
  48. 'group': 'apache',
  49. 'configfile': '/etc/httpd/conf/httpd.conf',
  50. 'mod_ssl': 'mod_ssl',
  51. 'mod_wsgi': 'mod_wsgi',
  52. 'conf_mod_wsgi': '/etc/httpd/conf.d/wsgi.conf',
  53. 'mod_php5': 'php',
  54. 'mod_pagespeed_source': 'https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_x86_64.rpm',
  55. 'vhostdir': '/etc/httpd/vhosts.d',
  56. 'confdir': '/etc/httpd/conf.d',
  57. 'confext': '.conf',
  58. 'default_site': 'default',
  59. 'default_site_ssl': 'default-ssl',
  60. 'logdir': '/var/log/httpd',
  61. 'logrotatedir': '/etc/logrotate.d/httpd',
  62. 'wwwdir': '/var/www',
  63. 'default_charset': 'UTF-8',
  64. },
  65. 'Suse': {
  66. 'server': 'apache2',
  67. 'service': 'apache2',
  68. 'user': 'wwwrun',
  69. 'group': 'www',
  70. 'configfile': '/etc/apache2/httpd.conf',
  71. 'mod_wsgi': 'apache2-mod_wsgi',
  72. 'mod_php5': 'apache2-mod_php5',
  73. 'mod_fcgid': 'apache2-mod_fcgid',
  74. 'vhostdir': '/etc/apache2/vhosts.d',
  75. 'confdir': '/etc/apache2/conf.d',
  76. 'confext': '.conf',
  77. 'default_site': 'vhost.template',
  78. 'default_site_ssl': 'vhost-ssl.template',
  79. 'logdir': '/var/log/apache2',
  80. 'wwwdir': '/srv/www',
  81. },
  82. 'FreeBSD': {
  83. 'server': 'apache24',
  84. 'service': 'apache24',
  85. 'user': 'www',
  86. 'group': 'www',
  87. 'configfile': '/usr/local/etc/apache24/httpd.conf',
  88. 'portsfile': '/usr/local/etc/apache24/ports.conf',
  89. 'mod_php5': 'mod_php56',
  90. 'mod_perl2': 'ap24-mod_perl2',
  91. 'mod_wsgi': 'ap24-mod_wsgi3',
  92. 'vhostdir': '/usr/local/etc/apache24/Includes',
  93. 'confdir': '/usr/local/etc/apache24/extra',
  94. 'modulesdir': '/usr/local/etc/apache24/modules.d',
  95. 'global_document_root': '/usr/local/www/apache24/data',
  96. 'confext': '',
  97. 'default_site': 'default',
  98. 'default_site_ssl': 'default-ssl',
  99. 'logdir': '/var/log/',
  100. 'wwwdir': '/usr/local/www/apache24/',
  101. },
  102. 'Arch': {
  103. 'server': 'apache',
  104. 'service': 'httpd',
  105. 'user': 'http',
  106. 'group': 'http',
  107. 'configfile': '/etc/httpd/conf/httpd.conf',
  108. 'mod_wsgi': 'mod_wsgi',
  109. 'vhostdir': '/etc/httpd/conf/vhosts',
  110. 'confdir': '/etc/httpd/conf/extra',
  111. 'modulesdir': '/usr/lib/httpd/modules',
  112. 'confext': '.conf',
  113. 'logdir': '/var/log/httpd',
  114. 'wwwdir': '/srv/http',
  115. 'default_site': 'default',
  116. 'default_site_ssl': 'default-ssl',
  117. },
  118. }, merge=salt['grains.filter_by']({
  119. 'precise': {
  120. 'confext': '',
  121. 'default_site': 'default',
  122. 'default_site_ssl': 'default-ssl',
  123. },
  124. 'trusty': {
  125. 'confext': '.conf',
  126. 'default_site': '000-default.conf',
  127. 'default_site_ssl': 'default-ssl.conf',
  128. },
  129. 'utopic': {
  130. 'confext': '.conf',
  131. 'default_site': '000-default.conf',
  132. 'default_site_ssl': 'default-ssl.conf',
  133. },
  134. 'vivid': {
  135. 'confext': '.conf',
  136. 'default_site': '000-default.conf',
  137. 'default_site_ssl': 'default-ssl.conf',
  138. },
  139. 'wily': {
  140. 'confext': '.conf',
  141. 'default_site': '000-default.conf',
  142. 'default_site_ssl': 'default-ssl.conf',
  143. },
  144. 'xenial': {
  145. 'confext': '.conf',
  146. 'default_site': '000-default.conf',
  147. 'default_site_ssl': 'default-ssl.conf',
  148. },
  149. 'yakkety': {
  150. 'confext': '.conf',
  151. 'default_site': '000-default.conf',
  152. 'default_site_ssl': 'default-ssl.conf',
  153. },
  154. 'zesty': {
  155. 'confext': '.conf',
  156. 'default_site': '000-default.conf',
  157. 'default_site_ssl': 'default-ssl.conf',
  158. },
  159. 'artful': {
  160. 'confext': '.conf',
  161. 'default_site': '000-default.conf',
  162. 'default_site_ssl': 'default-ssl.conf',
  163. },
  164. 'jessie': {
  165. 'wwwdir': '/var/www',
  166. 'confext': '.conf',
  167. 'default_site': '000-default.conf',
  168. 'default_site_ssl': 'default-ssl.conf',
  169. },
  170. 'stretch': {
  171. 'wwwdir': '/var/www',
  172. 'confext': '.conf',
  173. 'default_site': '000-default.conf',
  174. 'default_site_ssl': 'default-ssl.conf',
  175. },
  176. 'buster': {
  177. 'wwwdir': '/var/www',
  178. 'confext': '.conf',
  179. 'default_site': '000-default.conf',
  180. 'default_site_ssl': 'default-ssl.conf',
  181. },
  182. }, grain='oscodename', merge=salt['grains.filter_by'](
  183. osfingermap
  184. , grain='osfinger', merge=salt['pillar.get']('apache:lookup')))) %}
  185. {% set modsecurity = salt['grains.filter_by'](
  186. modsec
  187. , grain='os_family', merge=salt['pillar.get']('apache:mod_security')) or {} %}
  188. {# merge the os family/codename mod_sec's specific data over the defaults #}
  189. {% do apache.update({ 'mod_security': modsecurity }) %}