Last active
April 20, 2021 06:51
-
-
Save Akkiesoft/b43d6631219cdf4d5f6d1f4862544d07 to your computer and use it in GitHub Desktop.
しらんけどこんなんでいいんじゃない、しらんけど
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: set timer | |
hosts: all | |
become: yes | |
vars: | |
name: mytimer | |
start_exec: /usr/bin/python3 /home/pi/bme280tozabbix.py | |
timer: | |
- OnUnitActiveSec=1min | |
tasks | |
- name: copy systemd service file | |
copy: | |
content: | | |
[Unit] | |
Description=timer service for {{ name }} | |
[Service] | |
Type=oneshot | |
ExecStart={{ start_exec }} | |
[Install] | |
WantedBy=default.target | |
dest: /etc/systemd/system/{{ name }}.service | |
mode: 0644 | |
- name: copy systemd timer file | |
copy: | |
content: | | |
[Unit] | |
Description=timer for {{ name }} | |
[Timer] | |
{% for l in timer %} | |
{{ l }} | |
{% endfor %} | |
[Install] | |
WantedBy=timers.target | |
dest: /etc/systemd/system/{{ name }}.timer | |
mode: 0644 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment