123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- - name: "Install ssh packages"
- apt:
- pkg:
- - 'openssh-server'
- - 'openssh-client'
- state: 'present'
- when: with_ssh|bool
- tags:
- - 'ssh'
- - name: 'Install sshd configuration (Debian <= 8)'
- template:
- src: 'ssh/sshd_config.legacy.j2'
- dest: '/etc/ssh/sshd_config'
- owner: 'root'
- group: 'root'
- mode: 0644
- notify:
- - Restart ssh
- when: with_ssh|bool and ansible_lsb.major_release|int <= 8
- tags:
- - 'ssh'
- - name: 'Install sshd configuration (Debian >= 9)'
- template:
- src: 'ssh/sshd_config.j2'
- dest: '/etc/ssh/sshd_config'
- owner: 'root'
- group: 'root'
- mode: 0644
- notify:
- - Restart ssh
- when: with_ssh|bool and ansible_lsb.major_release|int >= 9
- tags:
- - 'ssh'
- - name: 'Ensure ssh is running'
- service:
- name: 'ssh'
- state: 'started'
- when: with_ssh|bool
- tags:
- - 'ssh'
- # vim: ft=yaml.ansible
|