ansible-playbooks/distribute-ssh-config.yml

17 lines
564 B
YAML
Raw Normal View History

---
- hosts: all
gather_facts: no
remote_user: root
tasks:
- name: generate ed25519 key
shell: ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -N '' < /dev/null
args:
creates: /etc/ssh/ssh_host_ed25519_key
- name: copy ssh config
copy: src={{ item.src }} dest={{ item.dest }} backup=yes
with_items:
- { src: 'files/ssh_config', dest: '/etc/ssh/ssh_config' }
- { src: 'files/sshd_config', dest: '/etc/ssh/sshd_config' }
- name: restart sshd
service: name=ssh state=restarted