Remove banner reference

This commit is contained in:
Theo Le Peltier 2022-06-29 10:55:26 +02:00
parent dbf4d327cf
commit cf7e3da48e
No known key found for this signature in database
GPG Key ID: D75A16EA05CA9836
7 changed files with 2 additions and 35 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
###VSCode###
.vscode
###MacOS### ###MacOS###
.DS_Store .DS_Store

View File

@ -1,9 +1,6 @@
--- ---
motd_disable_default_motd: true 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_template: https://raw.githubusercontent.com/claranet/motd/master/scripts/00-basic
motd_banner_template_prepend: ""
motd_banner_template_append: ""
motd_template_prepend: "" motd_template_prepend: ""
motd_template_append: | motd_template_append: |
@ -13,5 +10,3 @@ motd_template_append: |
motd_template_username: "" motd_template_username: ""
motd_template_password: "" motd_template_password: ""
motd_banner_template_username: "{{ motd_template_username }}"
motd_banner_template_password: "{{ motd_template_password }}"

View File

@ -3,7 +3,6 @@
hosts: all hosts: all
roles: roles:
- role: claranet.motd - role: claranet.motd
motd_banner_template: null
pre_tasks: pre_tasks:
- name: "Update APT cache" - name: "Update APT cache"

View File

@ -12,11 +12,6 @@ motd_file_path = "/usr/local/bin/dynmotd"
pam_line = f"session optional pam_exec.so type=open_session stdout {motd_file_path}" 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): def test_motd_file(host):
file = host.file(motd_file_path) file = host.file(motd_file_path)
assert file.exists assert file.exists

View File

@ -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
...

View File

@ -1,6 +1,4 @@
--- ---
- include_tasks: configure_banner.yml
- name: include_tasks disable_default_motd.yml if motd_disable_default_motd is True - name: include_tasks disable_default_motd.yml if motd_disable_default_motd is True
include_tasks: disable_default_motd.yml include_tasks: disable_default_motd.yml
when: motd_disable_default_motd|bool when: motd_disable_default_motd|bool

View File

@ -2,10 +2,6 @@
_motd_sshd_config_file_path: /etc/ssh/sshd_config _motd_sshd_config_file_path: /etc/ssh/sshd_config
_motd_pam_login_file_path: /etc/pam.d/login _motd_pam_login_file_path: /etc/pam.d/login
_motd_pam_sshd_file_path: /etc/pam.d/sshd _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_file_path: /usr/local/bin/dynmotd
_motd_lookup_method: "{{ 'url' if motd_template is match('http(s)?:\/\/') else 'template' }}" _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_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) }}"