Saltstack Official Apache Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

104 lines
3.0KB

  1. # frozen_string_literal: true
  2. # Overide by OS
  3. control 'apache configuration' do
  4. title 'should match desired lines'
  5. case platform[:family]
  6. when 'debian'
  7. vhostdir = '/etc/apache2/sites-available'
  8. logrotatedir = '/etc/logrotate.d/apache2'
  9. moddir = '/etc/apache2/mods-enabled'
  10. sitesdir = '/etc/apache2/sites-enabled'
  11. when 'suse'
  12. vhostdir = '/etc/apache2/vhosts.d'
  13. logrotatedir = '/etc/logrotate.d/apache2'
  14. moddir = '/etc/apache2/mods-enabled'
  15. sitesdir = '/etc/apache2/vhosts.d'
  16. when 'redhat', 'fedora'
  17. vhostdir = '/etc/httpd/conf.d'
  18. logrotatedir = '/etc/logrotate.d/httpd'
  19. moddir = '/etc/httpd/conf.modules.d'
  20. sitesdir = '/etc/httpd/conf.d'
  21. when 'gentoo'
  22. vhostdir = '/etc/apache2/vhosts.d'
  23. logrotatedir = '/etc/logrotate.d/apache2'
  24. moddir = '/etc/apache2/mods-enabled'
  25. sitesdir = '/etc/apache2/sites-enabled'
  26. # `linux` here is sufficient for `arch`
  27. when 'linux', 'arch'
  28. vhostdir = '/etc/httpd/conf/vhosts'
  29. logrotatedir = '/etc/logrotate.d/httpd'
  30. moddir = '/etc/httpd/conf.modules.d'
  31. sitesdir = '/etc/httpd/sites-enabled'
  32. when 'bsd'
  33. vhostdir = '/usr/local/etc/apache24/Includes'
  34. logrotatedir = '/usr/local/etc/logrotate.d/apache2'
  35. moddir = '/usr/local/etc/apache24/modules.d'
  36. # https://docs.freebsd.org/en/books/handbook/network-servers/#_virtual_hosting
  37. # All done under `/usr/local/etc/apache24/httpd.conf`
  38. sitesdir = '/usr/local/etc/apache24'
  39. end
  40. describe file(vhostdir) do
  41. it { should exist }
  42. it { should be_directory }
  43. its('type') { should eq :directory }
  44. end
  45. describe file(logrotatedir) do
  46. it { should exist }
  47. its('type') { should eq :file }
  48. end
  49. describe file(moddir) do
  50. it { should exist }
  51. it { should be_directory }
  52. its('type') { should eq :directory }
  53. end
  54. describe file(sitesdir) do
  55. it { should exist }
  56. it { should be_directory }
  57. its('type') { should eq :directory }
  58. end
  59. end
  60. control 'apache configuration (unique)' do
  61. title 'should be valid'
  62. config_file_group = 'root'
  63. case platform[:family]
  64. when 'debian'
  65. config_file = '/etc/apache2/apache2.conf'
  66. wwwdir = '/srv'
  67. when 'suse'
  68. config_file = '/etc/apache2/httpd.conf'
  69. wwwdir = '/srv/www'
  70. when 'redhat', 'fedora'
  71. config_file = '/etc/httpd/conf/httpd.conf'
  72. wwwdir = '/var/www'
  73. when 'gentoo'
  74. config_file = '/etc/apache2/httpd.conf'
  75. wwwdir = '/var/www'
  76. when 'linux', 'arch'
  77. config_file = '/etc/httpd/conf/httpd.conf'
  78. wwwdir = '/srv/http'
  79. when 'bsd'
  80. config_file = '/usr/local/etc/apache24/httpd.conf'
  81. config_file_group = 'wheel'
  82. wwwdir = '/usr/local/www/apache24/'
  83. end
  84. describe file(config_file) do
  85. it { should be_file }
  86. it { should be_grouped_into config_file_group }
  87. its('mode') { should cmp '0644' }
  88. its('content') do
  89. should include(
  90. 'This file is managed by Salt! Do not edit by hand!'
  91. )
  92. end
  93. end
  94. describe file(wwwdir) do
  95. it { should exist }
  96. it { should be_directory }
  97. its('type') { should eq :directory }
  98. end
  99. end