skylab
/
skylab-ansible
Archived
2
0
Fork 0
This repository has been archived on 2023-05-19. You can view files and clone it, but cannot push or open issues or pull requests.
skylab-ansible/skylab/core/roles/server/tasks/sshd.yaml

41 lines
1.2 KiB
YAML

---
- name: Configure SSH authentication settings
become: true
ansible.builtin.replace:
path: /etc/ssh/sshd_config
regexp: "{{ item.regex }}"
replace: "{{ item.value }}"
notify: [restart-sshd]
loop:
- regex: "^.*PermitRootLogin (yes|no).*$"
value: PermitRootLogin no
- regex: "^.*PasswordAuthentication (yes|no).*$"
value: PasswordAuthentication no
- regex: "^.*ChallengeResponseAuthentication (yes|no).*$"
value: ChallengeResponseAuthentication no
- regex: "^.*GSSAPIAuthentication (yes|no).*$"
value: GSSAPIAuthentication no
loop_control:
label: "{{ item.value }}"
- name: Disable dynamic MOTD on debian systems
when: ansible_os_family == "Debian"
ansible.builtin.replace:
path: /etc/pam.d/sshd
regexp: "^session optional pam_motd.so motd=/run/motd.dynamic"
replace: "#session optional pam_motd.so motd=/run/motd.dynamic"
- name: Disable Cockpit activation message on Rocky
when: ansible_distribution == "Rocky"
become: true
ansible.builtin.file:
path: /etc/motd.d/cockpit
state: absent
- name: Copy MOTD to remote
become: true
ansible.builtin.template:
src: motd.j2
dest: /etc/motd
mode: 0644