cloud-basis/tasks/sshd.yml
2023-08-20 10:30:25 +02:00

22 lines
570 B
YAML
Executable File

---
- name: install OpenSSH server
apt:
update_cache: yes
state: "{% if cloud_update | bool %}latest{% else %}present{% endif %}"
install_recommends: yes
pkg: openssh-server
- name: setup sshd_config
lineinfile:
path: "{{ sshd_conf }}"
regexp: '^#?{{ configline.split(" ")[0] }}{% if configline.split(" ") | length > 1 %} {% endif %}'
line: "{{ configline }}"
owner: root
group: root
mode: 0644
loop: "{{ ssh_configs }}"
loop_control:
loop_var: configline
label: "{{ configline }}"
notify: restart sshd service