Configure ssh for FreeBSD
This commit is contained in:
parent
a0effdf15f
commit
d77c2b7e46
1 changed files with 20 additions and 6 deletions
|
@ -6,15 +6,29 @@
|
||||||
regexp: '^#?\w*PasswordAuthentication (yes|no)'
|
regexp: '^#?\w*PasswordAuthentication (yes|no)'
|
||||||
line: 'PasswordAuthentication no'
|
line: 'PasswordAuthentication no'
|
||||||
register: changed_ssh_config
|
register: changed_ssh_config
|
||||||
- name: Enable SSH
|
- name: Enable SSH (Linux)
|
||||||
become: true
|
become: true
|
||||||
service:
|
systemd:
|
||||||
name: ssh
|
name: ssh.service
|
||||||
enabled: yes
|
enabled: yes
|
||||||
state: started
|
state: started
|
||||||
- name: Restart SSH
|
when: ansible_system == 'Linux'
|
||||||
|
- name: Enable SSH (FreeBSD)
|
||||||
become: true
|
become: true
|
||||||
service:
|
service:
|
||||||
name: ssh
|
name: sshd
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
||||||
|
when: ansible_system == 'FreeBSD'
|
||||||
|
- name: Restart SSH (Linux)
|
||||||
|
become: true
|
||||||
|
systemd:
|
||||||
|
name: ssh.service
|
||||||
state: restarted
|
state: restarted
|
||||||
when: changed_ssh_config.changed == true
|
when: changed_ssh_config.changed == true and ansible_system == 'Linux'
|
||||||
|
- name: Restart SSH (FreeBSD)
|
||||||
|
become: true
|
||||||
|
service:
|
||||||
|
name: sshd
|
||||||
|
state: restarted
|
||||||
|
when: changed_ssh_config.changed == true and ansible_system == 'FreeBSD'
|
||||||
|
|
Loading…
Reference in a new issue