weareinteractive.vsftpd

Ansible weareinteractive.vsftpd 角色

构建状态 Galaxy GitHub 标签 GitHub 星星

weareinteractive.vsftpd 是一个 Ansible 角色,功能如下:

  • 安装 vsftpd
  • 配置 vsftpd
  • 管理用户

注意:

由于 Ansible Galaxy 现在支持 组织,此角色已从 franklinkim.vsftpd 转移到 weareinteractive.vsftpd!

安装

使用 ansible-galaxy

$ ansible-galaxy install weareinteractive.vsftpd

使用 requirements.yml

- src: weareinteractive.vsftpd

使用 git

$ git clone https://github.com/weareinteractive/ansible-vsftpd.git weareinteractive.vsftpd

依赖

  • Ansible >= 2.4
  • {"role"=>"weareinteractive.openssl", "when"=>["vsftpd_enable_ssl|default(true)"], "tags"=>["openssl-dependency", "dependencies", "openssl"]}

变量

以下是此角色的所有默认变量列表,这些变量也可以在 defaults/main.yml 中找到。

---
#
# vsftpd_users:
#   - username: ftpuser
#     name: FTP 用户
#     state: present (默认) 或 absent
#     remove: yes 或 no (默认)
#     comment: FTP 文件传输用户
#     uid: 13370
#     home: /path/to/home
#     password: "{{ 'ftpuser' | password_hash('sha256', 'mysecretsalt') }}"
# vsftpd_config:
#   local_umask: 022
# vsftpd_seboolean:
#    ftp_home_dir: yes
#    ftpd_full_access: no
#

# 定义包 (版本)
vsftpd_package: vsftpd
# 要创建的用户,使用 nologin
vsftpd_users: []
# 开机自启
vsftpd_service_enabled: yes
# 当前状态: started, stopped
vsftpd_service_state: started
# 默认启用 ssl
vsftpd_enable_ssl: true
# 默认 ssl 密钥
vsftpd_key_file: ssl-cert-snakeoil.key
# 默认 ssl 证书
vsftpd_cert_file: ssl-cert-snakeoil.pem
# 配置变量
vsftpd_config: {}
# 要安装的配置模板,相对于 ansible 仓库根目录
vsftpd_config_template:
# 可选的 SELinux 布尔值设置,例如对于 RedHat
vsftpd_seboolean: {}

处理程序

这些是定义在 handlers/main.yml 中的处理程序。

---

- name: 重启 vsftpd
  service:
    name: vsftpd
    state: restarted
  when: vsftpd_service_state != 'stopped'
  # 忽略由于以下原因引起的错误: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=754762;msg=9
  ignore_errors: yes

用法

以下是一个示例 Playbook:

---

- hosts: all
  roles:
    - weareinteractive.vsftpd
  vars:
    vsftpd_users:
       - username: ftpuser
         name: FTP 用户
         password: "{{ 'ftpuser' | password_hash('sha256', 'mysecretsalt') }}"
    vsftpd_config:
      listen_port: 990
      local_enable: YES
      write_enable: YES
      chroot_local_user: YES
      xferlog_enable: YES
      log_ftp_protocol: YES
      allow_writeable_chroot: YES

测试

$ git clone https://github.com/weareinteractive/ansible-vsftpd.git
$ cd ansible-vsftpd
$ make test

贡献

在没有正式风格指南的情况下,尽量维护现有的编码风格。为任何新增或更改的功能添加单元测试和示例。

  1. 分叉它
  2. 创建功能分支(git checkout -b my-new-feature
  3. 提交更改(git commit -am '添加一些功能'
  4. 推送到分支(git push origin my-new-feature
  5. 创建新的 Pull Request

注意:要更新 README.md 文件,请安装并运行 ansible-role

$ gem install ansible-role
$ ansible-role docgen

许可证

版权所有 (c) We Are Interactive,根据 MIT 许可证。

关于项目

Installs, configures and adds user for vsftpd

安装
ansible-galaxy install weareinteractive.vsftpd
许可证
mit
下载
204.9k