Cleaned up tasks and etc.

This commit is contained in:
Larry Smith Jr 2018-09-11 22:07:50 -04:00
parent 20f6732f68
commit 007d5809e6
7 changed files with 39 additions and 197 deletions

View file

@ -1,39 +1,22 @@
Role Name
=========
# ansible-tftpd-hpa
An [Ansible] role to install/configure [tftpd-hpa]
An [Ansible](https://www.ansible.com) role to install/configure `tftpd-hpa`.
Requirements
------------
## Requirements
None
Role Variables
--------------
## Role Variables
```
---
# defaults file for ansible-tftpd-hpa
[defaults/main.yml](defaults/main.yml)
# Defines tftp root directory
tftp_directory: '/var/lib/tftpboot'
# Defines tftp options for daemon...(-c allow new files to be created)
tftp_options: '--secure -c'
tftp_netboot_file: 'netboot.tar.gz'
tftp_netboot_url: 'http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot'
```
Dependencies
------------
## Dependencies
None
Example Playbook
----------------
## Example Playbook
```
```yaml
---
- hosts: tftp_servers
become: true
@ -43,18 +26,14 @@ Example Playbook
tasks:
```
License
-------
## License
BSD
MIT
Author Information
------------------
## Author Information
Larry Smith Jr.
- @mrlesmithjr
- http://everythingshouldbevirtual.com
- mrlesmithjr [at] gmail.com
[Ansible]: <https://www.ansible.com>
[tftpd-hpa]: <https://help.ubuntu.com/community/TFTP>
- [@mrlesmithjr](https://www.twitter.com/mrlesmithjr)
- [EverythingShouldBeVirtual](http://www.everythingshouldbevirtual.com)
- [mrlesmithjr@gmail.com](mailto:mrlesmithjr@gmail.com)

View file

@ -2,10 +2,11 @@
# defaults file for ansible-tftpd-hpa
# Defines tftp root directory
tftp_directory: '/var/lib/tftpboot'
tftp_directory: /var/lib/tftpboot
# Defines tftp options for daemon...(-c allow new files to be created)
tftp_options: '--secure -c'
tftp_options: --secure -c
tftp_netboot_file: 'netboot.tar.gz'
tftp_netboot_url: 'http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot'
tftp_netboot_enable: false
tftp_netboot_file: netboot.tar.gz
tftp_netboot_url: http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot

View file

@ -2,5 +2,6 @@
# handlers file for ansible-tftpd-hpa
- name: restart tftpd-hpa
service:
name: "tftpd-hpa"
name: tftpd-hpa
state: restarted
become: true

View file

@ -1,150 +1,18 @@
galaxy_info:
author: Larry Smith Jr.
description: An [Ansible] role to install/configure [tftpd-hpa]
#company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
license: MIT
min_ansible_version: 1.2
# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If travis integration is cofigured, only notification for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
platforms:
#- name: EL
# versions:
# - all
# - 5
# - 6
# - 7
#- name: GenericUNIX
# versions:
# - all
# - any
#- name: Solaris
# versions:
# - all
# - 10
# - 11.0
# - 11.1
# - 11.2
# - 11.3
#- name: Fedora
# versions:
# - all
# - 16
# - 17
# - 18
# - 19
# - 20
# - 21
# - 22
#- name: Windows
# versions:
# - all
# - 2012R2
#- name: SmartOS
# versions:
# - all
# - any
#- name: opensuse
# versions:
# - all
# - 12.1
# - 12.2
# - 12.3
# - 13.1
# - 13.2
#- name: Amazon
# versions:
# - all
# - 2013.03
# - 2013.09
#- name: GenericBSD
# versions:
# - all
# - any
#- name: FreeBSD
# versions:
# - all
# - 8.0
# - 8.1
# - 8.2
# - 8.3
# - 8.4
# - 9.0
# - 9.1
# - 9.1
# - 9.2
- name: Ubuntu
versions:
# - all
# - lucid
# - maverick
# - natty
# - oneiric
# - precise
# - quantal
# - raring
# - saucy
- trusty
# - utopic
# - vivid
- xenial
#- name: SLES
# versions:
# - all
# - 10SP3
# - 10SP4
# - 11
# - 11SP1
# - 11SP2
# - 11SP3
#- name: GenericLinux
# versions:
# - all
# - any
#- name: Debian
# versions:
# - all
# - etch
# - jessie
# - lenny
# - squeeze
# - wheezy
galaxy_tags:
# List tags for your role here, one per line. A tag is
# a keyword that describes and categorizes the role.
# Users find roles by searching for tags. Be sure to
# remove the '[]' above if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of
# alphanumeric characters. Maximum 20 tags per role.
- system
- network
dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

View file

@ -5,34 +5,31 @@
state: directory
owner: tftp
group: tftp
become: true
- name: config_tftpd | configuring tftpd
template:
src: "etc/default/tftpd-hpa.j2"
dest: "/etc/default/tftpd-hpa"
owner: root
group: root
mode: 0644
notify: restart tftpd-hpa
- name: config_tftpd | configuring inetd
template:
src: "etc/inetd.conf.j2"
dest: "/etc/inetd.conf"
src: etc/default/tftpd-hpa.j2
dest: /etc/default/tftpd-hpa
owner: root
group: root
mode: 0644
become: true
notify: restart tftpd-hpa
- name: config_tftpd | Downloading Netboot
get_url:
url: "{{ tftp_netboot_url }}/{{ tftp_netboot_file }}"
dest: "{{ tftp_directory }}/{{ tftp_netboot_file }}"
become: true
when: tftp_netboot_enable
- name: config_tftpd | Extracting Netboot
unarchive:
src: "{{ tftp_directory }}/{{ tftp_netboot_file }}"
dest: "{{ tftp_directory }}"
copy: no
copy: false
args:
creates: "{{ tftp_directory }}/pxelinux.0"
become: true
when: tftp_netboot_enable

View file

@ -1,12 +1,6 @@
---
- name: debian | updating apt-cache
- name: debian | Installing tftpd-hpa
apt:
update_cache: true
cache_valid_time: 86400
- name: debian | installing packages
apt:
name: "{{ item }}"
with_items:
- tftpd-hpa
- inetutils-inetd
name: tftpd-hpa
state: present
become: true

View file

@ -1,6 +1,8 @@
# /etc/default/tftpd-hpa
{{ ansible_managed|comment }}
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="{{ tftp_directory }}"
TFTP_ADDRESS="[::]:69"
TFTP_OPTIONS="{{ tftp_options }}"
RUN_DAEMON="yes"