2020-12-03 18:30:42 +01:00
|
|
|
---
|
2020-12-07 17:28:51 +01:00
|
|
|
- name: Package, and config, deb distributions
|
|
|
|
block:
|
|
|
|
- name: Install the vsftpd package on deb distributions
|
|
|
|
apt: pkg=vsftpd state=present update_cache=yes cache_valid_time=3600
|
2020-12-03 18:50:48 +01:00
|
|
|
|
2020-12-07 17:28:51 +01:00
|
|
|
- name: Install the vsftpd configuration file
|
|
|
|
template: src=vsftpd.conf.j2 dest=/etc/vsftpd.conf mode=0444 owner=root group=root
|
|
|
|
notify: Restart the vsftpd server
|
|
|
|
tags: [ 'vsftpd', 'ftp', 'vsftpd_conf' ]
|
2020-12-03 18:50:48 +01:00
|
|
|
|
2020-12-07 17:28:51 +01:00
|
|
|
when: ansible_distribution_file_variety == "Debian"
|
2020-12-03 18:50:48 +01:00
|
|
|
tags: [ 'vsftpd', 'ftp' ]
|
|
|
|
|
2020-12-07 17:28:51 +01:00
|
|
|
- name: Package, and config, el
|
|
|
|
block:
|
|
|
|
- name: Install the vsftpd package on el distributions
|
|
|
|
yum: pkg=vsftpd state=present
|
|
|
|
|
|
|
|
- name: Install the vsftpd configuration file
|
2020-12-08 11:26:12 +01:00
|
|
|
template: src=vsftpd.conf.j2 dest={{ vsftpd_global_config_dir }}/vsftpd.conf mode=0444 owner=root group=root
|
2020-12-07 17:28:51 +01:00
|
|
|
notify: Restart the vsftpd server
|
|
|
|
tags: [ 'vsftpd', 'ftp', 'vsftpd_conf' ]
|
|
|
|
|
|
|
|
when: ansible_distribution_file_variety == "RedHat"
|
2020-12-03 18:50:48 +01:00
|
|
|
tags: [ 'vsftpd', 'ftp' ]
|
|
|
|
|
2020-12-07 17:28:51 +01:00
|
|
|
- name: Global configuration
|
|
|
|
block:
|
2020-12-08 11:26:12 +01:00
|
|
|
- name: Create the global config directory
|
|
|
|
file: dest={{ vsftpd_global_config_dir }} state=directory mode='0755' owner=root group=root
|
|
|
|
|
2020-12-07 17:28:51 +01:00
|
|
|
- name: Install the chroot list file
|
|
|
|
template: src=vsftpd_chroot_list.j2 dest={{ vsftpd_chroot_list_file }} mode=0444 owner=root group=root
|
2020-12-03 18:50:48 +01:00
|
|
|
|
2020-12-08 11:26:12 +01:00
|
|
|
- name: Create the user configs directory
|
|
|
|
file: dest={{ vsftpd_user_config_dir }} state=directory mode='0750' owner=root group=root
|
|
|
|
when: vsftpd_user_config_enabled
|
|
|
|
|
|
|
|
- name: Install the users configurations
|
|
|
|
template: src=vsftpd_user_config.j2 dest={{ vsftpd_user_config_dir }}/{{ item.login }} mode=0444 owner=root group=root
|
|
|
|
with_items: '{{ vsftp_chrooted_users }}'
|
|
|
|
when:
|
|
|
|
- vsftpd_user_config_enabled
|
|
|
|
- item.conf is defined
|
|
|
|
|
|
|
|
- name: Make /bin/true a valid shell
|
|
|
|
lineinfile: name=/etc/shells line="{{ vsftpd_valid_shell }}"
|
|
|
|
when: vsftpd_manage_valid_shells
|
|
|
|
|
2020-12-07 17:28:51 +01:00
|
|
|
tags: [ 'vsftpd', 'ftp', 'vsftpd_conf' ]
|
|
|
|
|
|
|
|
- name: vsftpd service
|
|
|
|
block:
|
|
|
|
- name: Start and enable the vsftpd server
|
|
|
|
service: name=vsftpd state=started enabled=yes
|
|
|
|
when: vsftpd_server_enabled
|
|
|
|
tags: [ 'vsftpd', 'ftp' ]
|
|
|
|
|
|
|
|
- name: Stop and disable the vsftpd server
|
|
|
|
service: name=vsftpd state=stopped
|
|
|
|
when: not vsftpd_server_enabled
|
|
|
|
|
|
|
|
tags: [ 'vsftpd', 'ftp' ]
|