diff --git a/handlers/main.yml b/handlers/main.yml index 1a04f2ff517d0e6e6971171eef54dac514affcfd..95ba30e3a78dc96cffdeb68db9d394a334dd5720 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -4,3 +4,8 @@ name: sshd enabled: true state: restarted + +- name: Delete old config + file: + path: /etc/ssh/sshd_config + state: absent diff --git a/tasks/main.yml b/tasks/main.yml index bad9e464d90832fde4c3b888b1f365168f0c2d01..2d8f134337a62990281b582a851d77cfbc8c7143 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -19,13 +19,7 @@ line: "#BEGIN ANSIBLE MANAGED SSH DEFAULTS" state: present check_mode: true - register: config_no_blocks - -- name: Delete old config - file: - path: /etc/ssh/sshd_config - state: absent - when: config_no_blocks.changed + notify: Delete old config - name: Load config template set_fact: