Browse Source

First commit: basic packages installation

Xabier de Zuazo 11 years ago
commit
12a23afc52
8 changed files with 217 additions and 0 deletions
  1. 8 0
      .gitignore
  2. 12 0
      CHANGELOG.md
  3. 68 0
      README.md
  4. 4 0
      attributes/auth.rb
  5. 3 0
      attributes/plugins.rb
  6. 3 0
      attributes/protocols.rb
  7. 7 0
      metadata.rb
  8. 112 0
      recipes/default.rb

+ 8 - 0
.gitignore

@@ -0,0 +1,8 @@
+.bundle
+.cache
+.kitchen
+bin
+metadata.json
+Gemfile.lock
+test/kitchen/.kitchen/
+.kitchen.local.yml

+ 12 - 0
CHANGELOG.md

@@ -0,0 +1,12 @@
+# CHANGELOG for dovecot
+
+This file is used to list changes made in each version of dovecot.
+
+## 0.1.0:
+
+* Initial release of dovecot
+
+- - -
+Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
+
+The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.

+ 68 - 0
README.md

@@ -0,0 +1,68 @@
+dovecot Cookbook
+================
+TODO: Enter the cookbook description here.
+
+e.g.
+This cookbook makes your favorite breakfast sandwhich.
+
+Requirements
+------------
+TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc.
+
+e.g.
+#### packages
+- `toaster` - dovecot needs toaster to brown your bagel.
+
+Attributes
+----------
+TODO: List you cookbook attributes here.
+
+e.g.
+#### dovecot::default
+<table>
+  <tr>
+    <th>Key</th>
+    <th>Type</th>
+    <th>Description</th>
+    <th>Default</th>
+  </tr>
+  <tr>
+    <td><tt>['dovecot']['bacon']</tt></td>
+    <td>Boolean</td>
+    <td>whether to include bacon</td>
+    <td><tt>true</tt></td>
+  </tr>
+</table>
+
+Usage
+-----
+#### dovecot::default
+TODO: Write usage instructions for each cookbook.
+
+e.g.
+Just include `dovecot` in your node's `run_list`:
+
+```json
+{
+  "name":"my_node",
+  "run_list": [
+    "recipe[dovecot]"
+  ]
+}
+```
+
+Contributing
+------------
+TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section.
+
+e.g.
+1. Fork the repository on Github
+2. Create a named feature branch (like `add_component_x`)
+3. Write you change
+4. Write tests for your change (if applicable)
+5. Run the tests, ensuring they all pass
+6. Submit a Pull Request using Github
+
+License and Authors
+-------------------
+Authors: TODO: List authors

+ 4 - 0
attributes/auth.rb

@@ -0,0 +1,4 @@
+
+default['dovecot']['auth'] = {}
+default['dovecot']['auth']['sql']['drivers'] = []
+

+ 3 - 0
attributes/plugins.rb

@@ -0,0 +1,3 @@
+
+default['dovecot']['plugins'] = [ 'sieve' ]
+

+ 3 - 0
attributes/protocols.rb

@@ -0,0 +1,3 @@
+
+default['dovecot']['protocols'] = [ 'imap' ]
+

+ 7 - 0
metadata.rb

@@ -0,0 +1,7 @@
+name             'dovecot'
+maintainer       'Onddo Labs, Sl.'
+maintainer_email 'team@onddo.com'
+license          'Apache 2.0'
+description      'Installs/Configures dovecot'
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version          '0.1.0'

+ 112 - 0
recipes/default.rb

@@ -0,0 +1,112 @@
+#
+# Cookbook Name:: dovecot
+# Recipe:: default
+#
+# Copyright 2013, Onddo Labs, Sl.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# packages
+#
+
+case node['platform']
+when 'redhat','centos','scientific','fedora','suse','amazon' then
+
+  # core, imap, pop3, lmtp, ldap, sqlite
+  package 'dovecot' do
+    action :install
+  end
+
+  # sieve
+  package 'dovecot-pigeonhole' do
+    action :install
+    only_if do node['dovecot']['plugins'].include?('sieve') end
+  end
+
+when 'debian', 'ubuntu' then
+
+  # core
+  package 'dovecot-core' do
+    action :install
+  end
+  package 'dovecot-gssapi' do
+    action :install
+  end
+
+  # imap
+  package 'dovecot-imapd' do
+    action :install
+    only_if do node['dovecot']['protocols'].include?('imap') end
+  end
+
+  # pop3
+  package 'dovecot-pop3d' do
+    action :install
+    only_if do node['dovecot']['protocols'].include?('pop3') end
+  end
+
+  # lmtp
+  package 'dovecot-lmtpd' do
+    action :install
+    only_if do node['dovecot']['protocols'].include?('lmtp') end
+  end
+
+  # sieve
+  package 'dovecot-sieve' do
+    action :install
+    only_if do node['dovecot']['plugins'].include?('sieve') end
+  end
+  package 'dovecot-managesieved' do
+    action :install
+    only_if do node['dovecot']['plugins'].include?('sieve') end
+  end
+
+  package 'dovecot-ldap' do
+    action :install
+    only_if do
+      node['dovecot']['auth']['ldap'].kind_of?(Array) and
+      node['dovecot']['auth']['ldap'].length > 0
+    end
+  end
+
+  package 'dovecot-sqlite' do
+    action :install
+    only_if do
+      node['dovecot']['auth']['sql']['drivers'].kind_of?(Array) and
+      node['dovecot']['auth']['sql']['drivers'].include?('sqlite')
+    end
+  end
+
+else
+  log('Unsupported platform, trying to guess dovecot packages') { level :warn }
+  package 'dovecot'
+end
+
+package 'dovecot-mysql' do
+  action :install
+  only_if do
+    node['dovecot']['auth']['sql']['drivers'].kind_of?(Array) and
+    node['dovecot']['auth']['sql']['drivers'].include?('mysql')
+  end
+end
+
+package 'dovecot-pgsql' do
+  action :install
+  only_if do
+    node['dovecot']['auth']['sql']['drivers'].kind_of?(Array) and
+    node['dovecot']['auth']['sql']['drivers'].include?('pgsql')
+  end
+end
+