pez-infra/ansible/roles/systemd_services/tasks/main.yml
Rasmus Wejlgaard 737d6e0bc1 initial commit
2026-03-28 12:39:41 +00:00

22 lines
694 B
YAML

---
# Deploy custom systemd unit files from the repo.
# Looks for unit files in services/<name>/<name>.service
- name: Copy systemd unit files
ansible.builtin.copy:
src: "{{ playbook_dir }}/services/{{ item }}/{{ item }}.service"
dest: "/etc/systemd/system/{{ item }}.service"
mode: '0644'
loop: "{{ systemd_services | default([]) }}"
register: systemd_services_unit_files
failed_when: false
notify: Reload systemd daemon
- name: Enable and start systemd services
ansible.builtin.systemd:
name: "{{ item.item }}"
state: started
enabled: true
loop: "{{ systemd_services_unit_files.results | default([]) }}"
when: item is not failed
failed_when: false