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.

171 line
5.4KB

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