diff --git a/tasks/configure_ssh_hardening.yml b/tasks/configure_ssh_hardening.yml
index 421c10963cf943a8708cdc744ebdafc747113df2..e2bc4523239ccb469c201bdad1956ce4f9ada2db 100644
--- a/tasks/configure_ssh_hardening.yml
+++ b/tasks/configure_ssh_hardening.yml
@@ -1,7 +1,7 @@
 ---
 # man update-crypto-policies for details
 - name: make sure that SSH on RHEL respects the custom settings in sshd_config
-  ansible.builtin.regex_replace:
+  ansible.builtin.lineinfile:
     path: "/etc/sysconfig/sshd"
     regexp: "# CRYPTO_POLICY="
     line: "CRYPTO_POLICY="