ckaserer.tftp
This is an Ansible role that helps you set up a TFTP (Trivial File Transfer Protocol) server on RHEL/CentOS 7. The main tasks for this role are to:
- Install the required packages
- Manage the configuration
- Handle SELinux settings
For more information on TFTP, check these references:
Requirements
No specific requirements.
Role Variables
The admin can configure the following variables:
Variable | Default | Comments (type) |
---|---|---|
tftp_anon_write |
false | Allows modifying files if true (Boolean) |
tftp_config |
/usr/lib/systemd/system/tftp.service | Path to the TFTP systemd unit file |
tftp_group |
root | Group for the tftp_root_directory |
tftp_home_dir |
false | Controls SELinux settings (Boolean) |
tftp_mode |
0755 | Permissions for the tftp_root_directory |
tftp_root_directory |
/var/lib/tftpboot | Path to the TFTP root directory |
tftp_server_args |
--secure | Command line options for the server |
tftp_server_foreman_support |
false | Enable Foreman support by setting up tftpd.map |
tftp_setype |
tftpdir_rw_t | SELinux context for TFTP root directory |
tftp_user |
root | Owner of the tftp_root_directory |
Dependencies
No dependencies needed.
Example Playbook
Refer to the test playbook
Testing
You can test this role using a Vagrant environment found in a separate branch called tests. Follow these steps to run the tests:
- Fetch the tests branch:
git fetch origin tests
- Create a Git worktree for the test code:
git worktree add tests tests
(requires at least Git v2.5.0). This creates a directorytests/
. - Navigate to the tests directory:
cd tests/
- Run
vagrant up
to create a VM and apply one of the test playbooks listed below.
The test playbooks:
test-minimal.yml
: Applies the role to a VM with default settings (no variable changes).test.yml
: Applies the role to a VM with some changed default values and places a README file in the TFTP root directory. You can then fetch this file from your host system using:$ tftp 127.0.0.1 6969 -c get README
The TFTP port (69) on the VM is linked to port 6969 on your host system, as noted by the localhost (127.0.0.1) and port number in the command.
Contributing
Any issues, feature requests, or ideas are welcome in the Issues section. Pull requests are also encouraged. Please create a topic branch and, when submitting, combine your commits into one with a clear message.
License
BSD
Author Information
Bert Van Vreckem (bert.vanvreckem@gmail.com)
Contributors:
- @ckaserer
- @kostyrevaa : Added Foreman support (v1.2.0)
- @pugnacity
Installs and configures a TFTP (Trivial File Transfer Protocol) server on RHEL/CentOS 7 and Ubuntu
ansible-galaxy install ckaserer.tftp