default.rb 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. #
  2. # Cookbook Name:: dovecot
  3. # Recipe:: default
  4. #
  5. # Copyright 2013, Onddo Labs, Sl.
  6. #
  7. # Licensed under the Apache License, Version 2.0 (the "License");
  8. # you may not use this file except in compliance with the License.
  9. # You may obtain a copy of the License at
  10. #
  11. # http://www.apache.org/licenses/LICENSE-2.0
  12. #
  13. # Unless required by applicable law or agreed to in writing, software
  14. # distributed under the License is distributed on an "AS IS" BASIS,
  15. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. # See the License for the specific language governing permissions and
  17. # limitations under the License.
  18. #
  19. #
  20. # packages
  21. #
  22. case node['platform']
  23. when 'redhat','centos','scientific','fedora','suse','amazon' then
  24. # core, imap, pop3, lmtp, ldap, sqlite
  25. package 'dovecot' do
  26. action :install
  27. end
  28. # sieve
  29. package 'dovecot-pigeonhole' do
  30. action :install
  31. only_if do node['dovecot']['plugins'].include?('sieve') end
  32. end
  33. when 'debian', 'ubuntu' then
  34. # core
  35. package 'dovecot-core' do
  36. action :install
  37. end
  38. package 'dovecot-gssapi' do
  39. action :install
  40. end
  41. # imap
  42. package 'dovecot-imapd' do
  43. action :install
  44. only_if do node['dovecot']['protocols'].include?('imap') end
  45. end
  46. # pop3
  47. package 'dovecot-pop3d' do
  48. action :install
  49. only_if do node['dovecot']['protocols'].include?('pop3') end
  50. end
  51. # lmtp
  52. package 'dovecot-lmtpd' do
  53. action :install
  54. only_if do node['dovecot']['protocols'].include?('lmtp') end
  55. end
  56. # sieve
  57. package 'dovecot-sieve' do
  58. action :install
  59. only_if do node['dovecot']['plugins'].include?('sieve') end
  60. end
  61. package 'dovecot-managesieved' do
  62. action :install
  63. only_if do node['dovecot']['plugins'].include?('sieve') end
  64. end
  65. package 'dovecot-ldap' do
  66. action :install
  67. only_if do
  68. node['dovecot']['auth']['ldap'].kind_of?(Array) and
  69. node['dovecot']['auth']['ldap'].length > 0
  70. end
  71. end
  72. package 'dovecot-sqlite' do
  73. action :install
  74. only_if do
  75. node['dovecot']['auth']['sql']['drivers'].kind_of?(Array) and
  76. node['dovecot']['auth']['sql']['drivers'].include?('sqlite')
  77. end
  78. end
  79. else
  80. log('Unsupported platform, trying to guess dovecot packages') { level :warn }
  81. package 'dovecot'
  82. end
  83. package 'dovecot-mysql' do
  84. action :install
  85. only_if do
  86. node['dovecot']['auth']['sql']['drivers'].kind_of?(Array) and
  87. node['dovecot']['auth']['sql']['drivers'].include?('mysql')
  88. end
  89. end
  90. package 'dovecot-pgsql' do
  91. action :install
  92. only_if do
  93. node['dovecot']['auth']['sql']['drivers'].kind_of?(Array) and
  94. node['dovecot']['auth']['sql']['drivers'].include?('pgsql')
  95. end
  96. end