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.

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