Adds in ATFTPD role - Ubuntu 16.04

We have done an amount of work making the Multinode AIO work with Xenial
on both the deployment host and the booted virtual machines.  Sadly
Cobbler was a large complex system which required poking and prodding to
make it work properly on Xenial. Instead we have created a small system
which is a PXE environment with TFTPboot, DHCPD server and various
pre-seeds.

This work is virtually complete and working, this is a first commit of
many to get this merged in. Starting with a small commit to get one of
the few Ansible roles we have in place. After this has been checked over
and merged in, we will push all the rest of the work making sure any
amendments or recommendations are made to the rest of our work.

This first commit is simply an Ansible Role to install and configure
ATFTP on Ubuntu 16.04 deployment host, and does not currently affect
other items.

Change-Id: I9bfd88d81d27d5a6af7b297b9a4426f5e6200baf
This commit is contained in:
Rick Box 2017-02-01 18:46:30 +00:00
parent 3d0ab1bef5
commit 49ccdbeb2c
8 changed files with 176 additions and 0 deletions

View File

@ -0,0 +1,23 @@
atftpd_install
=========
This module installs atftpd and allows you to set the path of where it reads tftp from
Requirements
------------
This module requires Ansible 2.0
Role Variables
--------------
See defaults for variables and descriptions
Example Playbook
----------------
Example to call:
- hosts: all
roles:
- { role: atftpd_install, atftpd_path: /tftpboot }

View File

@ -0,0 +1,26 @@
---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# name: atftpd_install/defaults
# description: ALL our default variables for atftpd_install go in here
#------------------------------------------------------------------------------
# Packages - All our required packages we need installing
#------------------------------------------------------------------------------
packages:
- atftpd
# - variables
atftpd_path: /srv/tftp # Where is our defined atftp path
atftp_user: nobody # What user does ATFTPd run as
atftp_group: nogroup # What group does ATFTPd run as

View File

@ -0,0 +1,20 @@
---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# name: atftpd_install/handlers
# description: All our handlers for atftpd_install go in here
- name: atftpd_restart
service:
name: atftpd
state: restarted

View File

@ -0,0 +1,22 @@
---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
galaxy_info:
author: "Rick Box - BBC R&D"
license: Apache2
min_ansible_version: 2.0
platforms:
- name: Ubuntu
versions:
- xenial
dependencies: []

View File

@ -0,0 +1,39 @@
---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# module: atftpd_install/tasks/configure
# description: Configure atftpd_install
- name: Create group for application to run under
group:
name: "{{ atftp_group }}"
state: present
- name: Create user for application to run under
user:
name: "{{ atftp_user }}"
group: "{{ atftp_group }}"
state: present
- name: Atftp create directory and set permissions
file:
path: "{{ atftpd_path }}"
state: directory
owner: "{{ atftp_user }}"
group: "{{ atftp_group }}"
- name: Atftpd set /etc/init.d/atftpd to not use xinetd and set our tftp path
template:
src: atftpd.j2
dest: /etc/default/atftpd
notify: atftpd_restart

View File

@ -0,0 +1,25 @@
---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# module: atftpd_install/tasks/install
# description: Install our required packages for atftpd_install
- name: Install all required packages for atftpd_install
apt:
pkg: atftpd
state: latest
- name: Enable Atftpd on boot
service:
name: atftpd
enabled: yes

View File

@ -0,0 +1,18 @@
---
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# module: atftpd_install/tasks
# description: Install atftpd_install onto an Ubuntu 16.xx server
- include: install.yml
- include: configure.yml

View File

@ -0,0 +1,3 @@
### MANAGED BY {{ role_path|basename }} ANSIBLE ROLE ###
USE_INETD=false
OPTIONS="--user {{ atftp_user }}.{{ atftp_group }} --tftpd-timeout 300 --retry-timeout 5 --mcast-port 1758 --mcast-addr 239.239.239.0-255 --mcast-ttl 1 --maxthread 100 --verbose=5 {{ atftpd_path }}"