ansible-role-tftp/tasks/main.yml

45 lines
1.1 KiB
YAML

---
- name: Install and configure the tftpd server
block:
- name: Install the tftpd package on deb systems
ansible.builtin.apt:
pkg: '{{ tftpd_deb_package }}'
state: present
cache_valid_time: 1800
- name: Overwrite the /etc/default file, deb systems
ansible.builtin.template:
src: '{{ tftpd_default_file }}.j2'
dest: '/etc/default/{{ tftpd_default_file }}'
notify: Restart tftpd
when: ansible_os_family == "Debian"
tags: ['tfptd', 'tftp']
- name: Configure the tftpd server
block:
- name: Create the data directory, different from the default
ansible.builtin.file:
dest: '{{ tftpd_data_dir }}'
state: directory
owner: '{{ tftpd_user }}'
group: '{{ tftpd_group }}'
mode: 0750
when: tftpd_alternative_data_dir
tags: ['tfptd', 'tftp']
- name: Manage the tftpd service
block:
- name: Ensure that the tftpd service is running and enabled
ansible.builtin.service:
name: tftpd-hpa
state: started
enabled: True
when: ansible_os_family == "Debian"
tags: ['tfptd', 'tftp']
- meta: flush_handlers
tags: ['tfptd', 'tftp']