Files
nis/roles/common/tasks/pure-ftpd/authentication.yml
T

67 lines
2.6 KiB
YAML

---
# ---
# Authentication Configuration
# ---
- name: (pure-ftpd-install.yml) Get current authentications.
ansible.builtin.command: ls -1 {{ pureftpd_config_auth_dir }}
register: common_pureftpd_current_auth
changed_when: false
- name: (pure-ftpd-install.yml) Define empty pureftpd_authentications variable.
ansible.builtin.set_fact:
common_pureftpd_authentications: []
- name: (pure-ftpd-install.yml) Enable PureDB authentication.
ansible.builtin.file:
src: "{{ pureftpd_config_conf_dir }}/PureDB"
dest: "{{ pureftpd_config_auth_dir }}/{{ pureftpd_auth_puredb }}pure"
state: link
when: pureftpd_auth_puredb > 0 and pureftpd_config['PureDB'] is defined
notify: restart Pure-FTPd
- name: (pure-ftpd-install.yml) Add PureDB to Pure-FTPd authentications.
ansible.builtin.set_fact:
common_pureftpd_authentications: "{{ common_pureftpd_authentications }} + ['{{ pureftpd_auth_puredb }}pure']"
when: pureftpd_auth_puredb > 0 and pureftpd_config['PureDB'] is defined
- name: (pure-ftpd-install.yml) Add PAM to Pure-FTPd authentications.
ansible.builtin.set_fact:
common_pureftpd_authentications: "{{ common_pureftpd_authentications }} + ['{{ pureftpd_auth_pam }}pam']"
when: pureftpd_auth_pam > 0 and pureftpd_config['PAMAuthentication'] is defined
- name: (pure-ftpd-install.yml) Enable UNIX authentication.
ansible.builtin.file:
src: "{{ pureftpd_config_conf_dir }}/UnixAuthentication"
dest: "{{ pureftpd_config_auth_dir }}/{{ pureftpd_auth_unix }}unix"
state: link
when: pureftpd_auth_unix > 0 and pureftpd_config['UnixAuthentication'] is defined
notify: restart Pure-FTPd
- name: (pure-ftpd-install.yml) Add UnixAuthentication to Pure-FTPd authentications.
ansible.builtin.set_fact:
common_pureftpd_authentications: "{{ common_pureftpd_authentications }} + ['{{ pureftpd_auth_unix }}unix']"
when: pureftpd_auth_unix > 0 and pureftpd_config['UnixAuthentication'] is defined
- name: (pure-ftpd-install.yml) Enable PAM authentication.
ansible.builtin.file:
src: "{{ pureftpd_config_conf_dir }}/PAMAuthentication"
dest: "{{ pureftpd_config_auth_dir }}/{{ pureftpd_auth_pam }}pam"
state: link
when: pureftpd_auth_pam > 0 and pureftpd_config['PAMAuthentication'] is defined
notify: restart Pure-FTPd
# Delete unused authentification if exists
- name: (pure-ftpd-install.yml) Delete old authentications.
ansible.builtin.file:
path: "{{ pureftpd_config_auth_dir }}/{{ item }}"
state: absent
when: item not in common_pureftpd_authentications
with_items: "{{ common_pureftpd_current_auth.stdout_lines }}"
notify: restart Pure-FTPd