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 }}"