mono-infrastructure/ansible/playbooks/tasks/ssh_config.yml
nazunalika fcdf86b31c
Linting and Formatting
This commit appends the README.md to state that yaml files should start
with `---` and end with `...`. This also addresses some linting
warnings that were not appearing during pre-commit on local system.
2021-08-29 22:02:24 -07:00

47 lines
1.1 KiB
YAML

---
- name: Ensure SSH server is installed
package:
name: openssh-server
state: present
- name: Ensure SSH daemon is enabled
service:
name: sshd
enabled: true
# TODO: Prepare for /etc/ssh/sshd_config.d/* style of configuration
- name: SSH daemon configuration - global
block:
- name: SSH daemon configuration - base
template:
src: "etc/ssh/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-sshd_config.j2"
dest: "/etc/ssh/sshd_config"
owner: root
group: root
mode: '0600'
validate: /usr/sbin/sshd -t -f %s
backup: true
notify: restart_sshd
rescue:
- name: Print errors for configuration and validation
debug:
msg: "Error in SSH daemon configuration or template"
- name: SSH banner
copy:
src: "etc/rockybanner"
dest: "/etc/rockybanner"
owner: root
group: root
mode: '0644'
notify: restart_sshd
- name: Remove DSA keys
file:
path: "{{ item }}"
state: absent
with_items:
- /etc/ssh/ssh_host_dsa_key.pub
- /etc/ssh/ssh_host_dsa_key
...