]> git.somenet.org - root/pub/somesible.git/blob - roles/base/systemd/enable-and-start/tasks/main.yml
[roles/base/logrotate] install + update logrotate
[root/pub/somesible.git] / roles / base / systemd / enable-and-start / tasks / main.yml
1 #####################################
2 ### someone's ansible provisioner ###
3 #####################################
4 # Part of: https://git.somenet.org/root/pub/somesible.git
5 # 2017-2024 by someone <someone@somenet.org>
6 #
7 ---
8 - name: "setup enabling preset for {{ service_name }}"
9   template:
10     src: "{{item}}"
11     dest: "/etc/systemd/system-preset/10-somesible-{{ service_name }}.preset"
12     mode: 0644
13     owner: "root"
14     group: "root"
15   with_first_found:
16     - "{{lookup('env','PWD')}}/host_files/{{inventory_hostname}}/{{role_name}}/10-somesible-service.preset.j2"
17     - "{{lookup('env','PWD')}}/group_files/{{group_files_group}}/{{role_name}}/10-somesible-service.preset.j2"
18     - "{{lookup('env','PWD')}}/group_files/all/{{role_name}}/10-somesible-service.preset.j2"
19     - "templates/10-somesible-service.preset.j2"
20   when: not '@' in service_name
21   tags: ['systemd', 'systemd-enable-and-start']
22
23
24 - name: "enable and start {{ service_name }}"
25   systemd:
26     name: "{{ service_name }}"
27     daemon_reload: yes
28     enabled: yes
29     state: "{{ service_state }}"
30   tags: ['systemd', 'systemd-enable-and-start']
31   ignore_errors: yes