feat: restructure Ansible playbook and add SSH service handlers
Some checks failed
Nix Format Check / check-format (push) Failing after 37s

This commit is contained in:
2025-03-11 16:02:49 +01:00
parent d787b25917
commit 822704cd1d
4 changed files with 23 additions and 7 deletions

View File

@ -0,0 +1,12 @@
---
- name: Systemctl daemon-reload
become: true
ansible.builtin.systemd:
daemon_reload: true
- name: Restart SSH service
become: true
ansible.builtin.service:
name: ssh
state: restarted
enabled: true

View File

@ -1,5 +1,8 @@
- name: Configure all hosts
hosts: all
handlers:
- name: Import handler tasks
ansible.builtin.import_tasks: handlers/main.yml
gather_facts: true
tasks:

View File

@ -3,6 +3,12 @@
name: openssh-server
state: present
- name: Ensure SSH service is enabled and running
ansible.builtin.service:
name: ssh
state: started
enabled: true
- name: Ensure SSH server configuration is proper
ansible.builtin.template:
src: templates/sshd_config.j2
@ -11,9 +17,4 @@
group: root
mode: '0644'
validate: '/usr/sbin/sshd -t -f %s'
- name: Ensure SSH service is enabled and running
ansible.builtin.service:
name: ssh
state: started
enabled: true
notify: Restart SSH service