2018-02-27 17:10:25 +01:00
|
|
|
---
|
|
|
|
- include: accounts_password.yml
|
|
|
|
when: item.password is undefined
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: "{{ proftpd_accounts }}"
|
2018-02-27 17:10:25 +01:00
|
|
|
tags:
|
|
|
|
- proftpd
|
|
|
|
|
|
|
|
- set_fact:
|
2018-02-28 17:37:24 +01:00
|
|
|
proftpd_accounts_final: "{{ proftpd_accounts_final + [ item ] }}"
|
2018-02-27 17:10:25 +01:00
|
|
|
when: item.password is defined
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: "{{ proftpd_accounts }}"
|
2018-02-27 17:10:25 +01:00
|
|
|
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 }}:.*"
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: "{{ proftpd_accounts_final }}"
|
2018-02-27 17:10:25 +01:00
|
|
|
notify: restart proftpd
|
|
|
|
tags:
|
|
|
|
- proftpd
|
|
|
|
|
2019-01-24 11:47:03 +01:00
|
|
|
- name: Allow FTP account (FTP)
|
2018-02-27 17:10:25 +01:00
|
|
|
lineinfile:
|
|
|
|
dest: /etc/proftpd/conf.d/z-evolinux.conf
|
|
|
|
state: present
|
2018-02-27 17:24:21 +01:00
|
|
|
line: "\tAllowUser {{ item.name }}"
|
2018-02-27 17:10:25 +01:00
|
|
|
insertbefore: "DenyAll"
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: "{{ proftpd_accounts_final }}"
|
2018-02-27 17:10:25 +01:00
|
|
|
notify: restart proftpd
|
2021-05-09 23:06:42 +02:00
|
|
|
when: proftpd_ftp_enable | bool
|
2019-01-24 11:47:03 +01:00
|
|
|
tags:
|
|
|
|
- proftpd
|
|
|
|
|
|
|
|
- name: Allow FTP account (FTPS)
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/proftpd/conf.d/ftps.conf
|
|
|
|
state: present
|
|
|
|
line: "\tAllowUser {{ item.name }}"
|
|
|
|
insertbefore: "DenyAll"
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: "{{ proftpd_accounts_final }}"
|
2019-01-24 11:47:03 +01:00
|
|
|
notify: restart proftpd
|
2021-05-09 23:06:42 +02:00
|
|
|
when: proftpd_ftps_enable | bool
|
2019-01-24 11:47:03 +01:00
|
|
|
tags:
|
|
|
|
- proftpd
|
|
|
|
|
|
|
|
- name: Allow FTP account (SFTP)
|
|
|
|
lineinfile:
|
|
|
|
dest: /etc/proftpd/conf.d/sftp.conf
|
|
|
|
state: present
|
|
|
|
line: "\tAllowUser {{ item.name }}"
|
|
|
|
insertbefore: "DenyAll"
|
2021-05-04 14:18:40 +02:00
|
|
|
loop: "{{ proftpd_accounts_final }}"
|
2019-01-24 11:47:03 +01:00
|
|
|
notify: restart proftpd
|
2021-05-09 23:06:42 +02:00
|
|
|
when: proftpd_sftp_enable | bool
|
2018-02-27 17:10:25 +01:00
|
|
|
tags:
|
|
|
|
- proftpd
|
2022-09-13 16:29:59 +02:00
|
|
|
|
|
|
|
- name: Allow keys for SFTP account
|
2022-12-08 17:32:53 +01:00
|
|
|
template:
|
|
|
|
dest: "/etc/proftpd/sftp.authorized_keys/{{ _proftpd_account.name }}"
|
|
|
|
src: authorized_keys.j2
|
2022-12-09 10:19:51 +01:00
|
|
|
mode: 0644
|
2022-09-13 16:29:59 +02:00
|
|
|
loop: "{{ proftpd_accounts_final }}"
|
2022-12-08 17:32:53 +01:00
|
|
|
loop_control:
|
|
|
|
loop_var: _proftpd_account
|
2022-09-13 16:29:59 +02:00
|
|
|
notify: restart proftpd
|
2023-01-06 09:54:51 +01:00
|
|
|
when:
|
2022-09-13 16:29:59 +02:00
|
|
|
- proftpd_sftp_enable | bool
|
|
|
|
- proftpd_sftp_use_publickeys | bool
|
|
|
|
tags:
|
|
|
|
- proftpd
|