Skip to content

Commit 75f65b4

Browse files
Merge pull request openstack-k8s-operators#666 from bshephar/sshd-server-options
Use private variable for sshd_options
2 parents d10789e + b941b4a commit 75f65b4

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

roles/edpm_sshd/molecule/banners/converge.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@
2121
- name: osp.edpm.edpm_sshd
2222
edpm_sshd_motd_enabled: true
2323
edpm_sshd_banner_enabled: true
24+
edpm_sshd_banner_text: "Test banner"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
- name: Verify
3+
hosts: all
4+
tasks:
5+
- name: Ensure banner is set correctly
6+
ansible.builtin.lineinfile:
7+
path: /etc/ssh/sshd_config
8+
line: "Banner /etc/issue"
9+
state: present
10+
register: banner
11+
failed_when:
12+
- banner is changed

roles/edpm_sshd/tasks/configure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868

6969
- name: Update sshd configuration options from vars
7070
ansible.builtin.set_fact:
71-
edpm_sshd_server_options: |-
71+
_edpm_sshd_server_options: |-
7272
{% set _ = edpm_sshd_server_options.__setitem__('PasswordAuthentication', edpm_sshd_password_authentication) %}
7373
{% if edpm_sshd_banner_enabled %}
7474
{% set _ = edpm_sshd_server_options.__setitem__('Banner', '/etc/issue') %}

roles/edpm_sshd/templates/sshd_config_block.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## {{ ansible_managed }}
22

3-
{% for k, v in edpm_sshd_server_options.items() %}
3+
{% for k, v in _edpm_sshd_server_options.items() %}
44
{% if (v is iterable) and (v is not string) %}
55
{% set vars = (v | unique) %}
66
{% for var in vars %}

0 commit comments

Comments
 (0)