Skip to content

Commit

Permalink
[feature] support opensmtpd_extra_groups
Browse files Browse the repository at this point in the history
fixes #19
  • Loading branch information
Tomoyuki Sakurai committed Dec 2, 2017
1 parent a854255 commit cbb980a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ opensmtpd_extra_packages: []
opensmtpd_config: ""
opensmtpd_makemap_bin: "{{ __opensmtpd_makemap_bin }}"
opensmtpd_virtual_user: None
opensmtpd_extra_groups: []

opensmtpd_tables: []
6 changes: 6 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@

- include: "install-{{ ansible_os_family }}.yml"

- name: Add opensmtpd user to opensmtpd_extra_groups
user:
name: "{{ opensmtpd_user }}"
append: yes
groups: "{{ opensmtpd_extra_groups }}"

- name: Create opensmtpd_conf_dir
file:
dest: "{{ opensmtpd_conf_dir }}"
Expand Down
2 changes: 2 additions & 0 deletions tests/serverspec/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
roles:
- ansible-role-opensmtpd
vars:
opensmtpd_extra_groups:
- nobody
opensmtpd_virtual_user:
name: vmail
group: vmail
Expand Down
4 changes: 4 additions & 0 deletions tests/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
group: "vmail",
home: "/var/vmail"
}
extra_group = ["nobody"]

case os[:family]
when "freebsd"
Expand Down Expand Up @@ -101,6 +102,9 @@
describe user(user) do
it { should exist }
it { should belong_to_primary_group group }
extra_group.each do |g|
it { should belong_to_group g }
end
end

describe group(virtual_user[:group]) do
Expand Down

0 comments on commit cbb980a

Please sign in to comment.