Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH is not automatically reloaded when included via include_role due to Ansible limitations #301

Open
micolous opened this issue Oct 29, 2024 · 0 comments

Comments

@micolous
Copy link

When using this module via include_role on an Ubuntu 20.04.6 target, SSH is not automatically reloaded on config change.

This is because of an Ansible limitation: ansible/ansible#26537 ansible/proposals#136

My task definition (below) is itself included via include_tasks, because I'm using another pre-canned playbook for the system:

- name: Move sshd to port 222
  include_role:
    name: willshersystems.sshd
  vars:
    sshd_Port: 222
    sshd_manage_service: true
    sshd_allow_reload: true

When running the playbook, I can see it's updated the config successfully (in /etc/ssh/sshd_config.d/00-ansible_system_role.conf), but ss -tnl still shows sshd listening on [::]:22.

The Ansible debugging output seems to indicate that it's tried to validate the new config, and then start sshd if it wasn't already running (which is a no-op), but config changes don't seem to trigger Reload_sshd at all.

I've worked around this in my task definition by adding another step to manually reload sshd:

- name: Reload SSH config
  ansible.builtin.service:
    name: "ssh"
    state: reloaded

Expected behaviour

  • The docs mention this limitation for include_role
  • This module has some other way to trigger a service reload which doesn't depend on notifications

Versions

  • Ansible: 2.17.5
  • willshersystems.sshd: 0.25.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant