aboutsummaryrefslogtreecommitdiff
path: root/roles/host/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'roles/host/tasks')
-rw-r--r--roles/host/tasks/cpanel-dnsonly.yml2
-rw-r--r--roles/host/tasks/main.yml7
-rw-r--r--roles/host/tasks/ssh-harden.yml9
-rw-r--r--roles/host/tasks/systemd-user-network-check.yml7
-rw-r--r--roles/host/tasks/unprivileged-port.yml7
5 files changed, 17 insertions, 15 deletions
diff --git a/roles/host/tasks/cpanel-dnsonly.yml b/roles/host/tasks/cpanel-dnsonly.yml
index dbb9062..27b00fe 100644
--- a/roles/host/tasks/cpanel-dnsonly.yml
+++ b/roles/host/tasks/cpanel-dnsonly.yml
@@ -9,7 +9,7 @@
- name: Turn off firewalld
ansible.builtin.service:
name: "firewalld"
- state: stopped
+ state: "stopped"
enabled: false
- name: Create new tmp directory for podman
diff --git a/roles/host/tasks/main.yml b/roles/host/tasks/main.yml
index 0a205da..20fc54d 100644
--- a/roles/host/tasks/main.yml
+++ b/roles/host/tasks/main.yml
@@ -26,7 +26,8 @@
- ansible.builtin.import_tasks: patching.yml
when: host_patching | bool
+- ansible.builtin.import_tasks: ssh-harden.yml
+ when: host_ssh_harden | bool
+
- ansible.builtin.import_tasks: cpanel-dnsonly.yml
- tags:
- - never
- - cpanel-dnsonly
+ when: host_cpanel_installed | bool
diff --git a/roles/host/tasks/ssh-harden.yml b/roles/host/tasks/ssh-harden.yml
new file mode 100644
index 0000000..2df5bb2
--- /dev/null
+++ b/roles/host/tasks/ssh-harden.yml
@@ -0,0 +1,9 @@
+- name: Disable SSH password authentication
+ ansible.builtin.lineinfile:
+ dest: "/etc/ssh/sshd_config"
+ regexp: "^PasswordAuthentication"
+ line: "PasswordAuthentication no"
+ state: "present"
+ validate: "sshd -t -f %s"
+ notify:
+ - Restart sshd
diff --git a/roles/host/tasks/systemd-user-network-check.yml b/roles/host/tasks/systemd-user-network-check.yml
index 0b87e85..c1bc290 100644
--- a/roles/host/tasks/systemd-user-network-check.yml
+++ b/roles/host/tasks/systemd-user-network-check.yml
@@ -6,9 +6,4 @@
ansible.builtin.copy:
src: "check-network-online.service"
dest: "/etc/systemd/user/check-network-online.service"
- register: systemd
-
-- name: Reload systemd daemon
- ansible.builtin.systemd_service:
- daemon_reload: true
- when: systemd.changed
+ notify: Reload systemd daemon
diff --git a/roles/host/tasks/unprivileged-port.yml b/roles/host/tasks/unprivileged-port.yml
index c724e49..69a21f4 100644
--- a/roles/host/tasks/unprivileged-port.yml
+++ b/roles/host/tasks/unprivileged-port.yml
@@ -4,8 +4,5 @@
regexp: "^net.ipv4.ip_unprivileged_port_start="
line: "net.ipv4.ip_unprivileged_port_start={{ host_unprivileged_port_start }}"
create: true
- register: sysctl
-
-- name: Reload sysctl
- ansible.builtin.shell: "sysctl -p /etc/sysctl.d/50-UnprivilegedPort.conf"
- when: sysctl.changed
+ notify:
+ - Reload sysctl