Skip to content

An Ansible Role to install and configure a tftp server.

License

Notifications You must be signed in to change notification settings

while-true-do/ansible-role-srv_tftp

Repository files navigation

Github (tag) Github (license) Github (issues) Github (pull requests)

Travis (com)

Ansible (min. version) Ansible (platforms) Ansible (tags)

Ansible Role: srv_tftp

An Ansible Role to install and configure a tftp server.

Motivation

A very common scenario in IT Operations is, that a server needs to be deployed via PXE boot. This involves tftp and syslinux.

Description

This Ansible Role installs and configures tftp and syslinux.

  • install tftp-server
  • enable tftp-server
  • install syslinux packages
  • configure PXE Boot Configuration (pxelinux.cfg/default)

Requirements

Used Modules:

Installation

Install from Ansible Galaxy

ansible-galaxy install while_true_do.srv_tftp

Install from Github

git clone https://github.com/while-true-do/ansible-role-srv_tftp.git while_true_do.srv_tftp

Usage

Role Variables

---
# defaults file for while_true_do.srv_tftp

## Package Management
wtd_srv_tftp_package: "tftp-server"
# State can be present|latest|absent
wtd_srv_tftp_package_state: "present"

## Management for tftpboot
# tftp is most likely used for pxe, bootp
# enabled can be true|false
wtd_srv_tftp_boot_enabled: true

# Packages for tftpboot
wtd_srv_tftp_boot_package: "syslinux-tftpboot"
# State can be present|latest|absent
wtd_srv_tftp_boot_package_state: "present"

# Configuration for tftpboot
wtd_srv_tftp_boot_conf:
  timeout: "300"
  title: "PXE Boot"
  label_bootdisk: true
  label_hdt: false
  label_reboot: false
  label_poweroff: false
  labels: []
  # - label: ""
  #   default: false
  #   kernel: ""
  #   append: ""

## Service Management
wtd_srv_tftp_service: "tftp.socket"
# State can be started|stopped
wtd_srv_tftp_service_state: "started"
wtd_srv_tftp_service_enabled: true

## Firewalld Management
wtd_srv_tftp_fw_mgmt: true
wtd_srv_tftp_fw_service: "tftp"
# State can be enabled|disabled
wtd_srv_tftp_fw_state: "enabled"
# Zone can be according to defined zones on your machine.
wtd_srv_tftp_fw_zone: "public"

Example Playbook

Running Ansible Roles can be done in a playbook.

Simple

---
- hosts: all
  roles:
    - role: while_true_do.srv_tftp

Advanced

Configuring multiple labels. Be aware, that you have to download and prepare the needed OS files on your own.

- hosts: all
  roles:
  - role: while_true_do.srv_tftp
    wtd_srv_tftp_boot_conf:
      timeout: "100"
      title: "While True Do Boot"
      labels:
      - label: "CentOS 7.6"
        default: true
        kernel: "centos76/vmlinuz"
        append: "initrd=centos76/initrd.img"
      - label: "Fedora 30"
        kernel: "fedora30/vmlinuz"
        append: "initrd=fedora30/initrd.img"

Known Issues

  1. RedHat Testing is currently not possible in public, due to limitations in subscriptions.
  2. Some services and features cannot be tested properly, due to limitations in docker.

Testing

Most of the "generic" tests are located in the Test Library.

Ansible specific testing is done with Molecule.

Infrastructure testing is done with testinfra.

Automated testing is done with Travis CI.

Contribute

Thank you so much for considering to contribute. We are very happy, when somebody is joining the hard work. Please fell free to open Bugs, Feature Requests or Pull Requests after reading the Contribution Guideline.

See who has contributed already in the kudos.txt.

License

This work is licensed under a BSD-3-Clause License.

Contact