Skip to content
Snippets Groups Projects
Commit ce94ca49 authored by hofmann's avatar hofmann :speech_balloon:
Browse files

first init

parent 2c12222d
Branches
Tags
No related merge requests found
---
---
- block:
- name: Failing when timer_command is undefined
fail:
msg: Varible timer_command is not defined
when: item.value.timer_command is undefined
with_dict: "{{ timers }}"
- name: Uploading service file
template:
src: service.j2
dest: "{{ systemd_base_path | default('/etc/systemd/system') }}/{{ item.key }}.service"
owner: "{{ item.value.timer_user | default('root') }}"
group: "{{ item.value.timer_user | default('root') }}"
mode: 0644
with_dict: "{{ timers }}"
notify: Reload systemd
- name: Uploading timer file
template:
src: timer.j2
dest: "{{ systemd_base_path | default('/etc/systemd/system') }}/{{ item.key }}.timer"
owner: "{{ item.value.timer_user | default('root') }}"
group: "{{ item.value.timer_user | default('root') }}"
mode: 0644
with_dict: "{{ timers }}"
notify: Reload systemd
- name: Enabling timers
systemd:
name: "{{ item.key }}.timer"
state: restarted
enabled: true
masked: false
daemon_reload: true
scope: "{{ systemd_scope | default('system') }}"
with_dict: "{{ timers }}"
when: timers is defined
\ No newline at end of file
[Unit]
Description={{ item.key }} Timer
[Timer]
{% if item.value.timer_OnActiveSec is defined %}
OnActiveSec={{ item.value.timer_OnActiveSec }}
{% endif %}
{% if item.value.timer_OnBootSec is defined %}
OnBootSec={{ item.value.timer_OnBootSec }}
{% endif %}
{% if item.value.timer_OnStartupSec is defined %}
OnStartupSec={{ item.value.timer_OnStartupSec }}
{% endif %}
{% if item.value.timer_OnUnitActiveSec is defined %}
OnUnitActiveSec={{ item.value.timer_OnUnitActiveSec }}
{% endif %}
{% if item.value.timer_OnUnitInactiveSec is defined %}
OnUnitInactiveSec={{ item.value.timer_OnUnitInactiveSec }}
{% endif %}
{% if item.value.timer_OnCalendar is defined %}
OnCalendar={{ item.value.timer_OnCalendar }}
Persistent={{ item.value.timer_persistent | default('false') }}
{% endif %}
AccuracySec={{ item.value.timer_AccuracySec | default('15s') }}
[Install]
WantedBy=timers.target
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment