This repository has been archived on 2024-05-02. You can view files and clone it, but cannot push or open issues or pull requests.
omni-ansible/tasks/sshd/secure.yml
Ethan Paul f1639dce1e
Overhaul reuse structure from role to task orientation
The overall config this will end up with is going to be nowhere
near complicated enough to require the segmented structure of roles.
A single directory of reusable tasks and resources will be much better
2020-12-04 14:47:33 -05:00

30 lines
824 B
YAML

---
- name: Set parameters in sshd config
become: true
lineinfile:
path: /etc/ssh/sshd_config
regexp: "{{ item.match }}"
line: "{{ item.set }}"
state: present
loop:
- match: "#?PermitRootLogin (yes|no)"
set: "PermitRootLogin no"
- match: "#?Banner (none|/etc/issue.net)"
set: "Banner /etc/issue.net"
- match: "#?PasswordAuthentication (yes|no)"
set: "PasswordAuthentication no"
- match: "#?GSSAPIAuthentication (yes|no)"
set: "GSSAPIAuthentication no"
- match: "#?ChallengeResponseAuthentication (yes|no)"
set: "ChallengeResponseAuthentication no"
loop_control:
label: "{{ item.set }}"
register: _sshd_config_result
- name: Restart sshd service
when: _sshd_config_result.changed
become: true
systemd:
name: sshd
state: restarted