Bug 2040038

Summary: sshd system role does not add ansible_manged variable contents to /etc/ssh/sshd_config file
Product: Red Hat Enterprise Linux 8 Reporter: Brian Smith <briasmit>
Component: rhel-system-rolesAssignee: Jakub Jelen <jjelen>
Status: CLOSED ERRATA QA Contact: David Jež <djez>
Severity: unspecified Docs Contact: Jan Fiala <jafiala>
Priority: unspecified    
Version: 8.5CC: bfinger, djez, elpereir, jafiala, jjelen, nhosoi, pkettman, rmeggins, spetrosi
Target Milestone: rc   
Target Release: 8.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: role:sshd
Fixed In Version: rhel-system-roles-1.12.0-1.el8 Doc Type: Bug Fix
Doc Text:
.The SSHD System Role uses the correct template file In RHEL 8.5, the SSHD System Role used a wrong template file. As a consequence, the generated `sshd_config` file did not contain the `# Ansible managed` comment. The missing comment did not affect any functionality on the system. With this update, the system role uses the correct template file and `sshd_config` contains the correct `# Ansible managed` comment.
Story Points: ---
Clone Of:
: 2044408 (view as bug list) Environment:
Last Closed: 2022-05-10 14:12:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2044408    
Deadline: 2022-02-07   

Description Brian Smith 2022-01-12 21:50:30 UTC
Description of problem:
When using the sshd system role to manage the /etc/ssh/sshd_config file, it does not add the ansible_managed variable contents to the top of the file.  

Version-Release number of selected component (if applicable):
rhel-system-roles-1.7.3-2.el8.noarch

How reproducible:
Every time

Steps to Reproduce:
1. Run playbook:

- hosts: rhel8-server1
  vars:
    sshd_PermitRootLogin: no
    sshd:
      Compression: true

  roles:
    - role: rhel-system-roles.sshd


Actual results:
The /etc/ssh/sshd_config file on rhel8-server1 does not have a comment at the top indicating the file is managed by Ansible.

Comment 1 Rich Megginson 2022-01-18 20:05:42 UTC
With the current upstream code - I can reproduce the problem with tests/tests_config_namespace.yml but not with tests_set_common.yml - so I suspect it has something to do with the namespace handling

Comment 2 Jakub Jelen 2022-01-24 14:01:50 UTC
I can confirm that this is only an issue of the RHEL 8.5 package. But this was fixed in upstream as https://github.com/willshersystems/ansible-sshd/pull/168/ as well as in the RHEL 8.6 package.

The only issue with the RHEL 8.5 is that there is a bogus indent and missing "{ansible_managed | comment }" in the generated configuration file.

On the first sight, I do not see a simple workaround to get the configuration file without these issues in RHEL 8.5, but from functional point of view, it should not cause any issues (except for the "changed" reports after you update to RHEL 8.6).

Can we close this as a NEXTRELEASE or add to the RHEL 8.6 errata to check if there is something we can do to prevent such issues in the future at least from the QE side?

Comment 26 errata-xmlrpc 2022-05-10 14:12:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (rhel-system-roles bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2022:1896