mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-07-01 15:38:33 +02:00
bitwarden
This commit is contained in:
35
roles/ssh_banner/tasks/main.yml
Executable file
35
roles/ssh_banner/tasks/main.yml
Executable file
@ -0,0 +1,35 @@
|
||||
- block:
|
||||
- name: Install packages
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- figlet
|
||||
- toilet
|
||||
|
||||
- name: Create Banner
|
||||
ansible.builtin.command: |
|
||||
figlet -c {{ (inventory_hostname|split('.'))[0] }} -f slant
|
||||
register: logo
|
||||
|
||||
- name: Creating a file with content
|
||||
copy:
|
||||
dest: "/etc/banner"
|
||||
content: |
|
||||
{{ logo.stdout }}
|
||||
|
||||
- name: Reconfigure sshd
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: "^Banner.* "
|
||||
line: "Banner /etc/banner"
|
||||
|
||||
- name: Reconfigure sshd
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/ssh/sshd_config
|
||||
regexp: "^#PrintLastLog.* "
|
||||
line: "PrintLastLog no"
|
||||
|
||||
- name: sshd
|
||||
ansible.builtin.service:
|
||||
name: ssh.service
|
||||
state: restarted
|
||||
become: true
|
Reference in New Issue
Block a user