Completed 'services' role + tested on empty node. I also moved task from the main playbook to the 'common' role to better reflect the actions taken by each role

This commit is contained in:
2022-06-28 22:01:26 +01:00
parent cb9f425c9b
commit b7c93028e3
11 changed files with 276 additions and 55 deletions
+52 -7
View File
@@ -1,17 +1,17 @@
---
- name: Install required packages
apt:
ansible.builtin.apt:
name: "{{ item }}"
loop:
- curl
- tree
- ufw
- ntp
- tftpd-hpa
- syslog-ng
- vsftpd
- tftpd-hpa
- ntp
- ufw
- name: Configure UFW to allow inbound NTP, SSH, SYSLOG, FTP connections
- name: Configure UFW to allow inbound NTP, SSH, SYSLOG, FTP and TFTP connections
community.general.ufw:
rule: allow
direction: in
@@ -37,7 +37,7 @@
- port: '5142'
proto: tcp
- name: UFW - Deny all other incoming traffic by default
- name: Deny all other incoming IPv4 traffic
community.general.ufw:
state: enabled
policy: deny
@@ -51,9 +51,54 @@
- name: Apply NTP configuration file
ansible.builtin.copy:
src: ./configuration_files/ntp.conf
src: ntp.conf
dest: /etc/ntp.conf
owner: root
group: root
mode: '0644'
backup: yes
- name: Apply TFTP configuration file
ansible.builtin.copy:
src: tftpd-hpa
dest: /etc/default/tftpd-hpa
owner: root
group: root
mode: '0644'
backup: yes
- name: Create TFTP directory
ansible.builtin.file:
path: "/home/{{ ansible_user }}/Desktop/TFTP"
state: directory
owner: "{{ ansible_user }}"
group: "{{ ansible_user }}"
mode: '0777'
- name: Apply SYSLOG configuration file
ansible.builtin.copy:
src: syslog-ng-network-devices.conf
dest: /etc/syslog-ng/conf.d/syslog-ng-network-devices.conf
owner: root
group: root
mode: '0644'
backup: yes
- name: Apply FTP configuration file
ansible.builtin.copy:
src: vsftpd.conf
dest: /etc/vsftpd.conf
owner: root
group: root
mode: '0644'
backup: yes
- name: Enable installed services
ansible.builtin.service:
name: "{{ item }}"
enabled: yes
loop:
- ntp
- tftpd-hpa
- syslog-ng
- vsftpd