implement role

This commit is contained in:
vincent 2023-04-16 12:03:09 +02:00
parent 58c5aea839
commit 699b5ed523
5 changed files with 55 additions and 2 deletions

View File

@ -1,2 +1,13 @@
---
# defaults file for ansible-role-vsftpd
vsftpd_service_state: "started"
vsftpd_service_enabled: true
vsftpd_enable_ssl: false
vsftpd_cert_file: ssl-cert.pem
vsftpd_key_file: ssl-cert.key
# config variables
vsftpd_config: {}
vsftpd_sssd: true

View File

@ -1,2 +1,10 @@
---
# handlers file for ansible-role-vsftpd
- name: restart vsftpd
ansible.builtin.service:
name: vsftpd
state: restarted
when: vsftpd_service_state != 'stopped'
become: true
# Ignore errors due to: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=754762;msg=9
ignore_errors: yes

View File

@ -1,2 +1,35 @@
---
# tasks file for ansible-role-vsftpd
- name: Installing packages
ansible.builtin.package:
name: "{{ vsftpd_package }}"
state: present
become: true
- name: Configuring vsftp
ansible.builtin.template:
src: "vsftpd.j2"
dest: "{{ vsftpd_config_template_path }}"
owner: root
group: root
mode: "0644"
become: true
notify: restart vsftpd
- name: Configuring service
ansible.builtin.service:
name: vsftpd
state: "{{ vsftpd_service_state }}"
enabled: "{{ vsftpd_service_enabled }}"
become: true
- name: Configure pam for sssd
ansible.builtin.template:
src: "pam.d/vsftpd.j2"
dest: "/etc/pam.d/vsftpd"
owner: root
group: root
mode: "0644"
become: true
when: vsftpd_sssd == true

View File

@ -1,5 +1,4 @@
---
- hosts: localhost
remote_user: root
- hosts: all
roles:
- ansible-role-vsftpd

View File

@ -1,2 +1,4 @@
---
# vars file for ansible-role-vsftpd
vsftpd_package: vsftpd
vsftpd_config_template_path: "/etc/vsftpd.conf"