Skip to content

Commit

Permalink
Merge pull request #2 from Temelio/develop
Browse files Browse the repository at this point in the history
Use better default value for root datadir group
  • Loading branch information
achaussier committed May 26, 2016
2 parents b7f93a1 + c3ee3c6 commit 057ea1b
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,19 @@ files. SSHD configuration is not managed inside the role.

### Default role variables

# Path management about sftp users home dir
sftp_data_dir_path: '/var/sftp'
sftp_data_dir_mode: '0750'
sftp_data_dir_owner: 'root'
sftp_data_dir_group: "{{ sftp_users_group_name }}"

# Sftp users management
sftp_users_group_name: 'sftp-users'
sftp_users_home_mode: '0750'
sftp_users_skeleton: '/etc/skel'
sftp_users_shell: '/usr/sbin/nologin'
sftp_users: []

### SFTP users format

sftp_users:
Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
sftp_data_dir_path: '/var/sftp'
sftp_data_dir_mode: '0750'
sftp_data_dir_owner: 'root'
sftp_data_dir_group: 'root'
sftp_data_dir_group: "{{ sftp_users_group_name }}"

# Sftp users management
sftp_users_group_name: 'sftp-users'
Expand Down
10 changes: 10 additions & 0 deletions spec/installation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,16 @@
end
end

describe 'datadir directory' do
describe file('/var/sftp') do
it { should exist }
it { should be_directory }
it { should be_owned_by 'root' }
it { should be_grouped_into 'sftp-users' }
it { should be_mode 750 }
end
end

describe 'first user configuration' do

describe file('/var/sftp/sftp1/.ssh') do
Expand Down
14 changes: 7 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

# Main tasks file for sftp role

- name: 'Manage sftp users group'
become: True
group:
name: "{{ sftp_users_group_name }}"
state: 'present'


- name: 'Ensure data path exists'
become: True
file:
Expand All @@ -12,13 +19,6 @@
state: 'directory'


- name: 'Manage sftp users group'
become: True
group:
name: "{{ sftp_users_group_name }}"
state: 'present'


- name: 'Manage sftp users creation'
become: True
user:
Expand Down

0 comments on commit 057ea1b

Please sign in to comment.