]> git.phdru.name Git - ansible.git/blob - playbooks/debian/roles/sshd/tasks/main.yml
Feat(apt): Add option `cache_valid_time: 3600`
[ansible.git] / playbooks / debian / roles / sshd / tasks / main.yml
1 - name: Check sshd
2   shell: "grep -c '^PermitRootLogin' /etc/ssh/sshd_config || :"
3   register: sshd
4   changed_when: sshd.stdout == "0"
5
6 - debug:
7     msg: "sshd has already been configured"
8   when: sshd.stdout != "0"
9
10 - name: Configure sshd
11   become: true
12   lineinfile:
13     path: /etc/ssh/sshd_config
14     regexp: "^{{ item }}"
15     line: "{{ item }}"
16   loop: [
17     'PermitRootLogin prohibit-password',
18     '# See http://www.openssh.com/txt/cbc.adv',
19     'Ciphers aes128-ctr,aes256-ctr,aes128-cbc,aes256-cbc',
20     'PermitTunnel point-to-point',
21
22   ]
23   notify: Reload sshd
24   when: sshd.stdout == "0"