Giter Site home page Giter Site logo

ansible-role-tftp's Introduction

Ansible role tftp

An Ansible role for installing a TFTP (Trivial File Transfer Protocol) server on RHEL/CentOS 7. Specifically, the responsibilities of this role are to:

  • install the necessary packages
  • manage the configuration
  • manage SELinux settings

For more relevant documentation on TFTP, see:

Requirements

  • SELinux is expected to be enabled.

Role Variables

The following variables can be set by the administrator:

Variable Default Comments (type)
tftp_root_directory /var/lib/tftpboot The path to the root directory served by TFTP.
tftp_server_args --secure Arguments to be passed to the server (except root directory)
See the tftpd man page for details
tftp_server_foreman_support false Enable Foreman support by creating suitable tftpd.map
tftp_setype tftpdir_rw_t Default SELinux context for the root directory.
Set to public_content_rw_t to allow access through other services
tftp_anon_write no When set to "yes", tftp can modify public files.
tftp_home_dir no When set to "yes", tftp can modify files in user home directories.

The following variables usually should be left alone:

Variable Default Comments (type)
tftp_cps 100 2
tftp_disable no When set to 'yes', TFTP will be disabled.
tftp_flags IPv4
tftp_group root Group of tftp_root_directory
tftp_mode 0755 Permissions of tftp_root_directory
tftp_packages [libsemanage-python, tftp, tftp-server] Packages to be installed
tftp_per_source 11
tftp_protocol udp
tftp_server /usr/sbin/in.tftpd
tftp_service xinetd Name of the TFTP service
tftp_socket_type dgram
tftp_user root
tftp_wait yes

Dependencies

No dependencies.

Example Playbook

See the test playbook

Testing

Tests for this role are provided in the form of a Vagrant environment that is kept in a separate branch, tests. I use git-worktree(1) to include the test code into the working directory. Instructions for running the tests:

  1. Fetch the tests branch: git fetch origin tests
  2. Create a Git worktree for the test code: git worktree add tests tests (remark: this requires at least Git v2.5.0). This will create a directory tests/.
  3. cd tests/
  4. vagrant up will then create a VM and apply the second of the two available testing playbooks enumerated below.

The test playbooks:

  • test-minimal.yml applies the role to a VM, with default settings (no role variables are set).

  • test.yml applies the role to a VM, changing some default values. The playbook also puts a file named README into the TFTP root directory. After applying this playbook, you should be able to fetch that file from your host system (assuming the tftp client is installed):

    $ tftp 127.0.0.1 6969 -c get README

The TFTP port (69) on the VM is forwarded through the NAT interface to port 6969 on your host system, hence the 127.0.0.1 and port number in the command line.

You may want to change the base box into one that you like. The current one, bertvv/centos71 was generated using a Packer template from the Boxcutter project with a few modifications.

Contributing

Issues, feature requests, ideas are appreciated and can be posted in the Issues section. Pull requests are also very welcome. Preferably, create a topic branch and when submitting, squash your commits into one (with a descriptive message).

License

BSD

Author Information

Bert Van Vreckem ([email protected])

Contributions by:

ansible-role-tftp's People

Contributors

bertvv avatar trinitronx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.