diff --git a/playbooks/roles/apt_update_and_upgrade/handlers/main.yaml b/playbooks/roles/apt_update_and_upgrade/handlers/main.yaml new file mode 100644 index 0000000..001bbe4 --- /dev/null +++ b/playbooks/roles/apt_update_and_upgrade/handlers/main.yaml @@ -0,0 +1,3 @@ +- name: reboot the system + become: true + ansible.builtin.reboot: diff --git a/playbooks/roles/apt_update_and_upgrade/tasks/main.yaml b/playbooks/roles/apt_update_and_upgrade/tasks/main.yaml index f63436b..5d9181b 100644 --- a/playbooks/roles/apt_update_and_upgrade/tasks/main.yaml +++ b/playbooks/roles/apt_update_and_upgrade/tasks/main.yaml @@ -9,7 +9,5 @@ ansible.builtin.apt: upgrade: dist register: apt_update_and_upgrade__upgrade_result - - - name: reboot, after package upgrade - ansible.builtin.reboot: - when: apt_update_and_upgrade__upgrade_result.changed + notify: + - reboot the system diff --git a/playbooks/roles/deploy_ssh_server_config/handlers/main.yaml b/playbooks/roles/deploy_ssh_server_config/handlers/main.yaml new file mode 100644 index 0000000..001bbe4 --- /dev/null +++ b/playbooks/roles/deploy_ssh_server_config/handlers/main.yaml @@ -0,0 +1,3 @@ +- name: reboot the system + become: true + ansible.builtin.reboot: diff --git a/playbooks/roles/deploy_ssh_server_config/tasks/main.yaml b/playbooks/roles/deploy_ssh_server_config/tasks/main.yaml index 0492a35..714b0ca 100644 --- a/playbooks/roles/deploy_ssh_server_config/tasks/main.yaml +++ b/playbooks/roles/deploy_ssh_server_config/tasks/main.yaml @@ -11,13 +11,10 @@ owner: root group: root src: sshd_config.j2 - register: deploy_ssh_server_config__ssh_config_copy_result + notify: + # Reboot instead of just restarting the ssh service, since I don't know how Ansible reacts, when it restarts the service it probably needs for the connection. + - reboot the system - name: deactivate short moduli ansible.builtin.shell: cmd: awk '$5 >= 3071' /etc/ssh/moduli > /etc/ssh/moduli.tmp && mv /etc/ssh/moduli.tmp /etc/ssh/moduli - - # Rebooting here instead of restarting the ssh service, since I don't know how Ansible reacts, when it restarts the service it probably needs for the connection. - - name: reboot, if ssh server config got changed - ansible.builtin.reboot: - when: deploy_ssh_server_config__ssh_config_copy_result.changed