39 lines
990 B
YAML
39 lines
990 B
YAML
---
|
|
- name: "Enable passwordless sudo"
|
|
ansible.builtin.lineinfile:
|
|
path: /etc/sudoers
|
|
state: present
|
|
regexp: "^%sudo"
|
|
line: "%sudo ALL=(ALL) NOPASSWD: ALL"
|
|
validate: "visudo -cf %s"
|
|
|
|
- name: "Apply AlmaLinux specific config"
|
|
when: ansible_distribution == 'AlmaLinux'
|
|
ansible.builtin.import_role:
|
|
name: almalinux
|
|
|
|
- name: "Apply Debian specific config"
|
|
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
|
|
ansible.builtin.import_role:
|
|
name: debian
|
|
|
|
- name: Install sshd banner
|
|
ansible.builtin.template:
|
|
src: issue.net.j2
|
|
dest: /etc/issue.net
|
|
mode: "644"
|
|
|
|
- name: Setup sshd banner
|
|
ansible.builtin.lineinfile:
|
|
dest: /etc/ssh/sshd_config
|
|
line: "Banner /etc/issue.net"
|
|
state: present
|
|
notify: Restart ssh
|
|
|
|
- name: Disallow root SSH access
|
|
ansible.builtin.lineinfile:
|
|
dest: /etc/ssh/sshd_config
|
|
regexp: "^PermitRootLogin"
|
|
line: "PermitRootLogin no"
|
|
state: present
|
|
# notify: Restart ssh
|