aboutsummaryrefslogtreecommitdiffstats
path: root/roles/space_server/tasks/sshd.yml
blob: 8eaa8fc11266b93ea335b8bfa26cd65df3871fac (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
---
- name: Install sshd package
  dnf:
    name: openssh-server
    state: latest
  notify:
    - restart sshd
  tags:
    - packages

- name: Configure sshd
  lineinfile:
    path: '/etc/ssh/sshd_config'
    regexp: '^PasswordAuthentication'
    line: 'PasswordAuthentication no'
  notify:
    - restart sshd

- name: Enable sshd service
  systemd:
    name: sshd.service
    enabled: yes
    masked: no
    state: started
  when: "'container' not in ansible_env"
- name: '- when in nspawn'
  command: systemctl enable sshd.service
  args:
    creates: '/etc/systemd/system/multi-user.target.wants/sshd.service'
  when: "'container' in ansible_env"

# vim: set ts=2 sw=2 et: