---

- name: Check that vsftpd is installed
  urpmi: name=vsftpd state=installed no-recommends=yes
  tags: vsftpd

- name: Configure vsftpd ftp group
  user: name=ftp state=present

- name: Configure vsftpd ftpnobody group
  user: name=ftpnobody state=present

- name: Configure vsftpd ftp user
  user: name=ftp home=/prj/ftp group=ftp shell=/bin/false state=present

- name: Configure vsftpd ftpnobody user
  user: name=ftpnobody home=/var/empty group=ftpnobody shell=/sbin/nologin state=present

- name: Configure vsftpd
  copy: src={{ item }} dest=/etc/vsftpd/{{ item | basename }} owner=root group=root mode=0640 backup=yes
  with_fileglob: [ 'files/*' ]
  notify:
    - restart vsftpd
  tags: vsftpd

- name: Check that vsftpd is running and enabled
  service: name=vsftpd state=started enabled=yes
  tags: vsftpd
