Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make postfixadmin installation optional #9

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ Attributes
| `node['postfix-dovecot']['vmail']['gid']` | `node['postfix-dovecot']['vmail']['uid']` | Virtual mail system group id.
| `node['postfix-dovecot']['vmail']['home']` | `'/var/vmail'` | Virtual mail user home path.

## Postfixadmin Attributes

You can use `node['postfix-dovecot']['postfixadmin']['enabled']` to disable the installation of Postfixadmin.

| Attribute | Default | Description |
|:---------------------------------------------|:---------------|:----------------------------------|
| `node['postfix-dovecot']['postfixadmin']['enabled']` | `true` | Whether to enable [Postfixadmin](https://github.com/zuazo/postfixadmin-cookbook).

## Amazon SES Attributes

You can use `node['postfix-dovecot']['ses']['enabled']` to enable SES for sending emails.
Expand Down
22 changes: 22 additions & 0 deletions attributes/postfixadmin.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# encoding: UTF-8
#
# Cookbook Name:: postfix-dovecot
# Attributes:: postfixadmin
# Author:: Xabier de Zuazo (<xabier@zuazo.org>)
# Copyright:: Copyright (c) 2013 Onddo Labs, SL.
# License:: Apache License, Version 2.0
#
# 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.
#

default['postfix-dovecot']['postfixadmin']['enabled'] = true
8 changes: 8 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,11 @@
type: 'hash',
required: 'optional',
calculated: true

attribute 'postfix-dovecot/postfixadmin/enabled',
display_name: 'postfixadmin enabled',
description: 'Whether to enable Postfixadmin.',
type: 'string',
choice: %w(true false),
required: 'recommended',
default: 'true'
18 changes: 10 additions & 8 deletions recipes/postfixadmin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
# limitations under the License.
#

node.default['postfixadmin']['server_name'] =
node['postfix-dovecot']['hostname']
node.default['postfixadmin']['common_name'] =
node['postfix-dovecot']['hostname']
node.default['postfixadmin']['database']['type'] =
node['postfix-dovecot']['database']['type']
if node['postfix-dovecot']['postfixadmin']['enabled']
node.default['postfixadmin']['server_name'] =
node['postfix-dovecot']['hostname']
node.default['postfixadmin']['common_name'] =
node['postfix-dovecot']['hostname']
node.default['postfixadmin']['database']['type'] =
node['postfix-dovecot']['database']['type']

include_recipe 'postfixadmin'
include_recipe 'postfixadmin::map_files'
include_recipe 'postfixadmin'
include_recipe 'postfixadmin::map_files'
end