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.

212 lines
6.6KB

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