63 lines
1.5 KiB
YAML
63 lines
1.5 KiB
YAML
---
|
|
- include: accounts_password.yml
|
|
when: item.password is undefined
|
|
with_items: "{{ proftpd_accounts }}"
|
|
tags:
|
|
- proftpd
|
|
|
|
- set_fact:
|
|
proftpd_accounts_final: "{{ proftpd_accounts_final + [ item ] }}"
|
|
when: item.password is defined
|
|
with_items: "{{ proftpd_accounts }}"
|
|
tags:
|
|
- proftpd
|
|
|
|
- name: Create FTP account
|
|
lineinfile:
|
|
dest: /etc/proftpd/vpasswd
|
|
state: present
|
|
create: yes
|
|
mode: "0440"
|
|
line: "{{ item.name | mandatory }}:{{ item.password }}:{{ item.uid }}:{{ item.gid }}::{{ item.home | mandatory }}:/bin/false"
|
|
regexp: "^{{ item.name }}:.*"
|
|
with_items: "{{ proftpd_accounts_final }}"
|
|
notify: restart proftpd
|
|
tags:
|
|
- proftpd
|
|
|
|
- name: Allow FTP account (FTP)
|
|
lineinfile:
|
|
dest: /etc/proftpd/conf.d/z-evolinux.conf
|
|
state: present
|
|
line: "\tAllowUser {{ item.name }}"
|
|
insertbefore: "DenyAll"
|
|
with_items: "{{ proftpd_accounts_final }}"
|
|
notify: restart proftpd
|
|
when: proftpd_ftp_enable
|
|
tags:
|
|
- proftpd
|
|
|
|
- name: Allow FTP account (FTPS)
|
|
lineinfile:
|
|
dest: /etc/proftpd/conf.d/ftps.conf
|
|
state: present
|
|
line: "\tAllowUser {{ item.name }}"
|
|
insertbefore: "DenyAll"
|
|
with_items: "{{ proftpd_accounts_final }}"
|
|
notify: restart proftpd
|
|
when: proftpd_ftps_enable
|
|
tags:
|
|
- proftpd
|
|
|
|
- name: Allow FTP account (SFTP)
|
|
lineinfile:
|
|
dest: /etc/proftpd/conf.d/sftp.conf
|
|
state: present
|
|
line: "\tAllowUser {{ item.name }}"
|
|
insertbefore: "DenyAll"
|
|
with_items: "{{ proftpd_accounts_final }}"
|
|
notify: restart proftpd
|
|
when: proftpd_sftp_enable
|
|
tags:
|
|
- proftpd
|