From 49ccdbeb2cf78c1d295f224129186cb9683516ba Mon Sep 17 00:00:00 2001 From: Rick Box Date: Wed, 1 Feb 2017 18:46:30 +0000 Subject: [PATCH] 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 --- .../roles/atftpd_install/README.md | 23 +++++++++++ .../roles/atftpd_install/defaults/main.yml | 26 +++++++++++++ .../roles/atftpd_install/handlers/main.yml | 20 ++++++++++ .../roles/atftpd_install/meta/main.yml | 22 +++++++++++ .../roles/atftpd_install/tasks/configure.yml | 39 +++++++++++++++++++ .../roles/atftpd_install/tasks/install.yml | 25 ++++++++++++ .../roles/atftpd_install/tasks/main.yml | 18 +++++++++ .../roles/atftpd_install/templates/atftpd.j2 | 3 ++ 8 files changed, 176 insertions(+) create mode 100644 multi-node-aio-xenial-ansible/roles/atftpd_install/README.md create mode 100644 multi-node-aio-xenial-ansible/roles/atftpd_install/defaults/main.yml create mode 100644 multi-node-aio-xenial-ansible/roles/atftpd_install/handlers/main.yml create mode 100644 multi-node-aio-xenial-ansible/roles/atftpd_install/meta/main.yml create mode 100644 multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/configure.yml create mode 100644 multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/install.yml create mode 100644 multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/main.yml create mode 100644 multi-node-aio-xenial-ansible/roles/atftpd_install/templates/atftpd.j2 diff --git a/multi-node-aio-xenial-ansible/roles/atftpd_install/README.md b/multi-node-aio-xenial-ansible/roles/atftpd_install/README.md new file mode 100644 index 00000000..7160a76d --- /dev/null +++ b/multi-node-aio-xenial-ansible/roles/atftpd_install/README.md @@ -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 } diff --git a/multi-node-aio-xenial-ansible/roles/atftpd_install/defaults/main.yml b/multi-node-aio-xenial-ansible/roles/atftpd_install/defaults/main.yml new file mode 100644 index 00000000..38f97185 --- /dev/null +++ b/multi-node-aio-xenial-ansible/roles/atftpd_install/defaults/main.yml @@ -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 diff --git a/multi-node-aio-xenial-ansible/roles/atftpd_install/handlers/main.yml b/multi-node-aio-xenial-ansible/roles/atftpd_install/handlers/main.yml new file mode 100644 index 00000000..b236c07d --- /dev/null +++ b/multi-node-aio-xenial-ansible/roles/atftpd_install/handlers/main.yml @@ -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 diff --git a/multi-node-aio-xenial-ansible/roles/atftpd_install/meta/main.yml b/multi-node-aio-xenial-ansible/roles/atftpd_install/meta/main.yml new file mode 100644 index 00000000..fe3e481e --- /dev/null +++ b/multi-node-aio-xenial-ansible/roles/atftpd_install/meta/main.yml @@ -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: [] diff --git a/multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/configure.yml b/multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/configure.yml new file mode 100644 index 00000000..2c67a4fb --- /dev/null +++ b/multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/configure.yml @@ -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 diff --git a/multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/install.yml b/multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/install.yml new file mode 100644 index 00000000..14c4bf46 --- /dev/null +++ b/multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/install.yml @@ -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 diff --git a/multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/main.yml b/multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/main.yml new file mode 100644 index 00000000..c2b8e5a4 --- /dev/null +++ b/multi-node-aio-xenial-ansible/roles/atftpd_install/tasks/main.yml @@ -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 diff --git a/multi-node-aio-xenial-ansible/roles/atftpd_install/templates/atftpd.j2 b/multi-node-aio-xenial-ansible/roles/atftpd_install/templates/atftpd.j2 new file mode 100644 index 00000000..b88263ef --- /dev/null +++ b/multi-node-aio-xenial-ansible/roles/atftpd_install/templates/atftpd.j2 @@ -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 }}"