aboutsummaryrefslogtreecommitdiffstats
path: root/roles/relayd/tasks/main.yml
blob: 8dc2837fa4fc7f5bd7cb55cba02716742675016c (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
---

- name: generate relayd configuration
  ansible.builtin.template:
    src: relayd.conf.j2
    dest: "{{ relayd_configuration_file }}"
    owner: 0
    group: 0
    mode: "0640"
  register: relayd_result_generate_configuration

- name: lint relayd configuration
  ansible.builtin.command: "relayd -nf {{ relayd_configuration_file }}"
  register: relayd_result_lint_configuration
  changed_when:
    - relayd_result_generate_configuration.changed
    - relayd_result_lint_configuration.rc != 0

- name: restart relayd  # noqa: no-handler
  ansible.builtin.service:
    name: relayd
    state: restarted
  when: relayd_result_generate_configuration.changed
    or relayd_result_lint_configuration.changed

- name: enable relayd
  ansible.builtin.service:
    name: relayd
    enabled: true
remember that computers suck.