|
@@ -1,10 +1,13 @@
|
|
-- name: Install pure-ftpd related packages
|
|
|
|
- apt: pkg={{ item }} state=installed update_cache=yes
|
|
|
|
|
|
+- name: 'Install pure-ftpd related packages'
|
|
|
|
+ apt:
|
|
|
|
+ pkg: '{{ item }}'
|
|
|
|
+ state: 'installed'
|
|
|
|
+ update_cache: 'yes'
|
|
with_items:
|
|
with_items:
|
|
- - pure-ftpd
|
|
|
|
|
|
+ - 'pure-ftpd'
|
|
when: with_ftp
|
|
when: with_ftp
|
|
|
|
|
|
-- name: Install pure-ftpd configuration
|
|
|
|
|
|
+- name: 'Install pure-ftpd configuration'
|
|
lineinfile:
|
|
lineinfile:
|
|
dest: '/etc/pure-ftpd/conf/{{ item.dest }}'
|
|
dest: '/etc/pure-ftpd/conf/{{ item.dest }}'
|
|
regexp: '{{ item.regexp }}'
|
|
regexp: '{{ item.regexp }}'
|
|
@@ -20,20 +23,23 @@
|
|
- { dest: 'VerboseLog', regexp: '^(yes|no)', line: 'no' }
|
|
- { dest: 'VerboseLog', regexp: '^(yes|no)', line: 'no' }
|
|
- { dest: 'MinUID', regexp: '^[0-9]+$', line: '34' } # Debian's uid(backup) = 34
|
|
- { dest: 'MinUID', regexp: '^[0-9]+$', line: '34' } # Debian's uid(backup) = 34
|
|
notify:
|
|
notify:
|
|
- - Restart pure-ftpd
|
|
|
|
|
|
+ - 'Restart pure-ftpd'
|
|
when: with_ftp
|
|
when: with_ftp
|
|
|
|
|
|
-- name: Enable pure-ftpd internal DB
|
|
|
|
- file: src=/etc/pure-ftpd/conf/PureDB path=/etc/pure-ftpd/auth/80puredb state=link
|
|
|
|
|
|
+- name: 'Enable pure-ftpd internal DB'
|
|
|
|
+ file:
|
|
|
|
+ src: '/etc/pure-ftpd/conf/PureDB'
|
|
|
|
+ path: '/etc/pure-ftpd/auth/80puredb'
|
|
|
|
+ state: 'link'
|
|
notify:
|
|
notify:
|
|
- - Restart pure-ftpd
|
|
|
|
|
|
+ - 'Restart pure-ftpd'
|
|
when: with_ftp
|
|
when: with_ftp
|
|
|
|
|
|
-- name: Clean up pure-ftpd internal DB
|
|
|
|
|
|
+- name: 'Clean up pure-ftpd internal DB'
|
|
raw: pure-pw list 2>/dev/null | sed -r 's/^(\S+)\s.*$/\1/' | while read u ; do pure-pw userdel "${u}" ; done
|
|
raw: pure-pw list 2>/dev/null | sed -r 's/^(\S+)\s.*$/\1/' | while read u ; do pure-pw userdel "${u}" ; done
|
|
when: with_ftp
|
|
when: with_ftp
|
|
|
|
|
|
-- name: Create FTP accounts home directory
|
|
|
|
|
|
+- name: 'Create FTP accounts home directory'
|
|
file:
|
|
file:
|
|
path: '{{item.home}}'
|
|
path: '{{item.home}}'
|
|
owner: '{{item.uid}}'
|
|
owner: '{{item.uid}}'
|
|
@@ -43,15 +49,17 @@
|
|
with_items: ftp_accounts
|
|
with_items: ftp_accounts
|
|
when: ftp_accounts and with_ftp
|
|
when: ftp_accounts and with_ftp
|
|
|
|
|
|
-- name: Add FTP accounts in pure-ftpd
|
|
|
|
|
|
+- name: 'Add FTP accounts in pure-ftpd'
|
|
raw: printf "{{item.password}}\n{{item.password}}\n" | pure-pw useradd "{{item.user}}" -d "{{item.home}}" -u "{{item.uid}}" -g "{{item.gid}}"
|
|
raw: printf "{{item.password}}\n{{item.password}}\n" | pure-pw useradd "{{item.user}}" -d "{{item.home}}" -u "{{item.uid}}" -g "{{item.gid}}"
|
|
with_items: ftp_accounts
|
|
with_items: ftp_accounts
|
|
when: ftp_accounts and with_ftp
|
|
when: ftp_accounts and with_ftp
|
|
|
|
|
|
-- name: Rebuild pure-ftpd internal DB
|
|
|
|
|
|
+- name: 'Rebuild pure-ftpd internal DB'
|
|
raw: pure-pw mkdb 2>/dev/null
|
|
raw: pure-pw mkdb 2>/dev/null
|
|
when: with_ftp
|
|
when: with_ftp
|
|
|
|
|
|
-- name: Ensure pure-ftpd is running
|
|
|
|
- service: name=pure-ftpd state=started
|
|
|
|
|
|
+- name: 'Ensure pure-ftpd is running'
|
|
|
|
+ service:
|
|
|
|
+ name: 'pure-ftpd'
|
|
|
|
+ state: 'started'
|
|
when: with_ftp
|
|
when: with_ftp
|