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 reloaded by default even if sshd_manage_service is set to false #236

Closed
Ouack23 opened this issue May 7, 2023 · 6 comments · Fixed by #303
Closed

SSH is reloaded by default even if sshd_manage_service is set to false #236

Ouack23 opened this issue May 7, 2023 · 6 comments · Fixed by #303
Assignees
Labels
docs Documentation issue

Comments

@Ouack23
Copy link

Ouack23 commented May 7, 2023

Hello,

The documentation states that :

* `sshd_allow_reload`

If set to *false*, a reload of sshd wont happen on change. This can help with
troubleshooting. You'll need to manually reload sshd if you want to apply the
changed configuration. Defaults to the same value as `sshd_manage_service`.
(Except on AIX, where `sshd_manage_service` is default *false*, but
`sshd_allow_reload` is default *true*)

but the default variables set sshd_allow_reload to true : https://github.com/willshersystems/ansible-sshd/blob/master/defaults/main.yml#L14

So either the documentation is wrong and should be corrected, or the defaults file should be changed like this:

# If the below is false, don't reload the ssh daemon on change
- sshd_allow_reload: true
+ sshd_allow_reload: "{{ sshd_manage_service }}"

Thank you for reading :)

@Jakuje
Copy link
Collaborator

Jakuje commented May 15, 2023

When this was introduced in bcd864f, the documentation was matching the code. But it is "broken" since 43ed7c1 which dropped the assignment.

I am worried that the problem with such assignment might have issues with the variable precedence (would have to double-check though). Do you want to open a PR with this change, ideally also with a reproducer tests to verify that it works as expected in the testing environment (probably only by checking variables as they are based on containers and do not have services running)?

@mattwillsher mattwillsher self-assigned this Sep 4, 2024
@mattwillsher mattwillsher added the docs Documentation issue label Sep 4, 2024
@Jakuje
Copy link
Collaborator

Jakuje commented Dec 17, 2024

@mattwillsher the change wont be that easy as proposed in the issue. I think the defaults/main.yml are evaluated before the user variables are considered so it might be easier to update documentation ...

@richm
Copy link
Collaborator

richm commented Dec 17, 2024

@mattwillsher the change wont be that easy as proposed in the issue. I think the defaults/main.yml are evaluated before the user variables are considered so it might be easier to update documentation ...

It depends - variables defined in defaults/main.yml, and in vars (which includes vars/main.yml as well as inline vars:) are lazily evaluated - they are only evaluated when the value is actually needed - and defaults/main.yml has the lowest precedence https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#ansible-variable-precedence - so it might work

@mattwillsher
Copy link
Member

I was thinking update the docs, which seems to be the original ask?

Could the logic be moved into the when clause for the AIX reload?
Or shift it to an __sshd_allow_reload in vars as others are handled? That a bigger change though.

@richm
Copy link
Collaborator

richm commented Dec 17, 2024

I was thinking update the docs, which seems to be the original ask?

Ah, ok. Works for me.

Could the logic be moved into the when clause for the AIX reload? Or shift it to an __sshd_allow_reload in vars as others are handled? That a bigger change though.

Jakuje added a commit to Jakuje/ansible-sshd that referenced this issue Dec 18, 2024
This did not work since 43ed7c1, for over 7 years so instead
of restoring this behavior, updating documentation to match
current beharior sounds more reasonable.

Fixes: willshersystems#236

Signed-off-by: Jakub Jelen <[email protected]>
@Jakuje
Copy link
Collaborator

Jakuje commented Dec 18, 2024

so it might work

it does not sounds very convincing :)

In any case, I guess we would need some test coverage.

On the other hand, the semantics of defaults depending on other variable sounds awkward. And given that this really did not work for last 7 years, adjusting the documentation to match reality sounds like the best.

Added to #303.

@mattwillsher mattwillsher linked a pull request Dec 19, 2024 that will close this issue
Jakuje added a commit that referenced this issue Dec 19, 2024
This did not work since 43ed7c1, for over 7 years so instead
of restoring this behavior, updating documentation to match
current beharior sounds more reasonable.

Fixes: #236

Signed-off-by: Jakub Jelen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants