Initial commit
This commit is contained in:
		
							
								
								
									
										66
									
								
								roles/common/tasks/pure-ftpd/authentication.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										66
									
								
								roles/common/tasks/pure-ftpd/authentication.yml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,66 @@ | ||||
| --- | ||||
|  | ||||
| # --- | ||||
| # Authentication Configuration | ||||
| # --- | ||||
|  | ||||
| - name: (pure-ftpd-install.yml) Get current authentications. | ||||
|   command: ls -1 {{ pureftpd_config_auth_dir }} | ||||
|   register: pureftpd_current_auth | ||||
|   changed_when: false | ||||
|  | ||||
| - name: (pure-ftpd-install.yml) Define empty pureftpd_authentications variable. | ||||
|   set_fact: | ||||
|     pureftpd_authentications: [] | ||||
|  | ||||
| - name: (pure-ftpd-install.yml) Enable PureDB authentication. | ||||
|   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. | ||||
|   set_fact: | ||||
|     pureftpd_authentications: "{{ 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. | ||||
|   set_fact: | ||||
|     pureftpd_authentications: "{{ 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. | ||||
|   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. | ||||
|   set_fact: | ||||
|     pureftpd_authentications: "{{ 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. | ||||
|   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. | ||||
|   file: | ||||
|     path: "{{ pureftpd_config_auth_dir }}/{{ item }}" | ||||
|     state: absent | ||||
|   when: item not in pureftpd_authentications | ||||
|   with_items: "{{ pureftpd_current_auth.stdout_lines }}" | ||||
|   notify: restart Pure-FTPd | ||||
		Reference in New Issue
	
	Block a user