From 06cc6fa26bf20f0baf20f75dde74fd3d5f176de6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavi=20Lle=C3=B3=20Tom=C3=A1s?= Date: Thu, 10 Oct 2024 13:36:16 +0200 Subject: [PATCH] Refs #8025 Rol debian-base. Task ssh move from debian-once to ., refactor handlers --- roles/debian-base/defaults/main.yaml | 4 ++++ roles/debian-base/handlers/main.yml | 4 ++++ roles/debian-base/tasks/main.yml | 2 ++ roles/{debian-once => debian-base}/tasks/ssh.yml | 3 ++- roles/debian-once/handlers/main.yml | 4 ---- roles/debian-once/tasks/main.yml | 2 -- 6 files changed, 12 insertions(+), 7 deletions(-) rename roles/{debian-once => debian-base}/tasks/ssh.yml (92%) delete mode 100644 roles/debian-once/handlers/main.yml diff --git a/roles/debian-base/defaults/main.yaml b/roles/debian-base/defaults/main.yaml index 92d106e..138dcdc 100644 --- a/roles/debian-base/defaults/main.yaml +++ b/roles/debian-base/defaults/main.yaml @@ -12,3 +12,7 @@ vn_host: url: http://apt.verdnatura.es/pool/main/v/vn-host package: vn-host_2.0.2_all.deb time_server_spain: ntp.roa.es +nagios_packages: + - nagios-nrpe-server + - nagios-plugins-contrib + - monitoring-plugins-basic diff --git a/roles/debian-base/handlers/main.yml b/roles/debian-base/handlers/main.yml index 8ffbd80..6d3fab4 100644 --- a/roles/debian-base/handlers/main.yml +++ b/roles/debian-base/handlers/main.yml @@ -14,6 +14,10 @@ systemd: name: nagios-nrpe-server state: restarted +- name: restart sshd + systemd: + name: sshd + state: restarted - name: generate locales command: /usr/sbin/locale-gen - name: reconfigure tzdata diff --git a/roles/debian-base/tasks/main.yml b/roles/debian-base/tasks/main.yml index 74471b2..0228231 100644 --- a/roles/debian-base/tasks/main.yml +++ b/roles/debian-base/tasks/main.yml @@ -2,6 +2,8 @@ tags: resolv - import_tasks: timesync.yml tags: timesync +- import_tasks: ssh.yml + tags: ssh - import_tasks: defuser.yml tags: defuser - import_tasks: install.yml diff --git a/roles/debian-once/tasks/ssh.yml b/roles/debian-base/tasks/ssh.yml similarity index 92% rename from roles/debian-once/tasks/ssh.yml rename to roles/debian-base/tasks/ssh.yml index 26f7a8b..0fb844b 100644 --- a/roles/debian-once/tasks/ssh.yml +++ b/roles/debian-base/tasks/ssh.yml @@ -3,7 +3,7 @@ path: /etc/ssh/ssh_host_rsa_key type: rsa size: 4096 - register: new_pair + register: new_pair - name: Configure sshd_config settings lineinfile: path: /etc/ssh/sshd_config @@ -22,3 +22,4 @@ - /etc/ssh/ssh_host_ed25519_key - /etc/ssh/ssh_host_ed25519_key.pub when: new_pair is succeeded + notify: restart sshd diff --git a/roles/debian-once/handlers/main.yml b/roles/debian-once/handlers/main.yml deleted file mode 100644 index 18c505e..0000000 --- a/roles/debian-once/handlers/main.yml +++ /dev/null @@ -1,4 +0,0 @@ -- name: restart sshd - systemd: - name: sshd - state: restarted diff --git a/roles/debian-once/tasks/main.yml b/roles/debian-once/tasks/main.yml index b77c6fc..e5da03c 100644 --- a/roles/debian-once/tasks/main.yml +++ b/roles/debian-once/tasks/main.yml @@ -1,4 +1,2 @@ -- import_tasks: ssh.yml - tags: ssh - import_tasks: root.yml tags: root