Externalize role

This commit is contained in:
Adrien Reslinger 2018-10-08 19:35:25 +02:00
commit 816d3a565d
Signed by: adrien
GPG key ID: DA7B27055C66D6DE
4 changed files with 49 additions and 0 deletions

4
handlers/main.yml Normal file
View file

@ -0,0 +1,4 @@
---
- name: Restart xinetd
service: name="xinetd" state=restarted

23
tasks/main.yml Normal file
View file

@ -0,0 +1,23 @@
---
- name: Include vars for {{ ansible_os_family }}
include_vars: "{{ ansible_os_family }}.yml"
- name: Install tftp packages
package: name="{{ tftp_packages_name }}" state=latest update_cache=yes
notify: Restart xinetd
- name: Deploy tftp configuration
template: src=xinetd_tftp.j2 dest=/etc/xinetd.d/tftp owner=root group=root mode=0644
notify: Restart xinetd
- name: Enable xinetd on boot
service: name=xinetd enabled=yes
- name: Open Firewalld
firewalld:
service: tftp
permanent: true
state: enabled
immediate: true
zone: internal

18
templates/xinetd_tftp.j2 Normal file
View file

@ -0,0 +1,18 @@
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = --verbose -s /var/lib/tftpboot
disable = no
per_source = 11
cps = 100 2
flags = IPv4
}

4
vars/RedHat.yml Normal file
View file

@ -0,0 +1,4 @@
---
tftp_packages_name:
- tftp-server
- xinetd