From cf7e3da48e46d2dbcefe28f9b7b214126e20b457 Mon Sep 17 00:00:00 2001 From: Theo Le Peltier Date: Wed, 29 Jun 2022 10:55:26 +0200 Subject: [PATCH 1/2] Remove banner reference --- .gitignore | 2 ++ defaults/main.yml | 5 ----- molecule/default/converge.yml | 1 - molecule/default/tests/test_default.py | 5 ----- tasks/configure_banner.yml | 18 ------------------ tasks/main.yml | 2 -- vars/main.yml | 4 ---- 7 files changed, 2 insertions(+), 35 deletions(-) delete mode 100644 tasks/configure_banner.yml diff --git a/.gitignore b/.gitignore index 2b61b44..2b9ec6c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +###VSCode### +.vscode ###MacOS### .DS_Store diff --git a/defaults/main.yml b/defaults/main.yml index ca8b1d2..46e1bc5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,9 +1,6 @@ --- motd_disable_default_motd: true -motd_banner_template: https://raw.githubusercontent.com/claranet/motd/master/banner motd_template: https://raw.githubusercontent.com/claranet/motd/master/scripts/00-basic -motd_banner_template_prepend: "" -motd_banner_template_append: "" motd_template_prepend: "" motd_template_append: | @@ -13,5 +10,3 @@ motd_template_append: | motd_template_username: "" motd_template_password: "" -motd_banner_template_username: "{{ motd_template_username }}" -motd_banner_template_password: "{{ motd_template_password }}" diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 8632b99..ee8f430 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -3,7 +3,6 @@ hosts: all roles: - role: claranet.motd - motd_banner_template: null pre_tasks: - name: "Update APT cache" diff --git a/molecule/default/tests/test_default.py b/molecule/default/tests/test_default.py index 6136f7e..0af0a69 100644 --- a/molecule/default/tests/test_default.py +++ b/molecule/default/tests/test_default.py @@ -12,11 +12,6 @@ pam_line = f"session optional pam_exec.so type=open_session stdout {motd_file_path}" -def test_banner_file(host): - file = host.file("/etc/banner") - assert not file.exists - - def test_motd_file(host): file = host.file(motd_file_path) assert file.exists diff --git a/tasks/configure_banner.yml b/tasks/configure_banner.yml deleted file mode 100644 index e366b6b..0000000 --- a/tasks/configure_banner.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- name: configure_banner | Apply template {{ motd_banner_template }} on {{ _motd_banner_file_path }} - copy: - content: "{{ motd_banner_template_prepend + _motd_banner_template_content + motd_banner_template_append }}" - dest: "{{ _motd_banner_file_path }}" - owner: root - group: root - mode: '0644' - when: motd_banner_template != None and motd_banner_template|length>0 - -- name: configure_banner | Ensure line "Banner {{ _motd_banner_file_path }}" is {{ _motd_banner_state }} in {{ _motd_sshd_config_file_path }} - lineinfile: - path: "{{ _motd_sshd_config_file_path }}" - regexp: "^(#?)Banner " - line: Banner {{ _motd_banner_file_path }} - state: "{{ _motd_banner_state }}" - notify: Restart sshd -... diff --git a/tasks/main.yml b/tasks/main.yml index 6f0cf46..8b64681 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,6 +1,4 @@ --- -- include_tasks: configure_banner.yml - - name: include_tasks disable_default_motd.yml if motd_disable_default_motd is True include_tasks: disable_default_motd.yml when: motd_disable_default_motd|bool diff --git a/vars/main.yml b/vars/main.yml index 49a0be7..7f99f07 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -2,10 +2,6 @@ _motd_sshd_config_file_path: /etc/ssh/sshd_config _motd_pam_login_file_path: /etc/pam.d/login _motd_pam_sshd_file_path: /etc/pam.d/sshd -_motd_banner_file_path: /etc/banner -_motd_banner_state: "{{ 'present' if motd_banner_template else 'absent' }}" _motd_file_path: /usr/local/bin/dynmotd _motd_lookup_method: "{{ 'url' if motd_template is match('http(s)?:\/\/') else 'template' }}" _motd_template_content: "{{ lookup(_motd_lookup_method, motd_template, split_lines=False, username=motd_template_username, password=motd_template_password) }}" -_motd_banner_lookup_method: "{{ 'url' if motd_banner_template is match('http(s)?:\/\/') else 'template' }}" -_motd_banner_template_content: "{{ lookup(_motd_banner_lookup_method, motd_banner_template, split_lines=False, username=motd_banner_template_username, password=motd_banner_template_password) }}" From 9770e5d43c82404f2ce904db5629af0beadd1c8c Mon Sep 17 00:00:00 2001 From: Theo Le Peltier Date: Wed, 29 Jun 2022 11:22:50 +0200 Subject: [PATCH 2/2] Change Centos to fedora for molecule test --- .github/workflows/molecule.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/molecule.yml b/.github/workflows/molecule.yml index 7fdb440..1cbf3bd 100644 --- a/.github/workflows/molecule.yml +++ b/.github/workflows/molecule.yml @@ -30,8 +30,8 @@ jobs: config: - image: "amazonlinux" tag: "latest" - - image: "centos" - tag: "8" + - image: "fedora" + tag: "28" - image: "debian" tag: "11" - image: "debian"