2024-12-11 23:10:40 +01:00
|
|
|
- block:
|
|
|
|
- name: Install packages
|
|
|
|
ansible.builtin.apt:
|
|
|
|
name:
|
|
|
|
- figlet
|
|
|
|
- toilet
|
2024-12-15 22:54:16 +01:00
|
|
|
|
2024-12-11 23:10:40 +01:00
|
|
|
- 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
|
2024-12-15 22:54:16 +01:00
|
|
|
become: true
|
|
|
|
|
|
|
|
|
|
|
|
|