mirror of
https://github.com/pigmonkey/spark.git
synced 2026-01-23 02:24:09 +00:00
use a single script/service/timer
This commit is contained in:
parent
fc8496e145
commit
3e9e43b9eb
6 changed files with 25 additions and 23 deletions
|
|
@ -1,4 +1,3 @@
|
|||
---
|
||||
- name: restart cryptshot
|
||||
service: name=cryptshot-{{ item.name }}.timer state=restarted
|
||||
with_items: "{{ cryptshot }}"
|
||||
service: name=cryptshot.timer state=restarted
|
||||
|
|
|
|||
|
|
@ -4,20 +4,3 @@
|
|||
|
||||
- name: Push {{ target.name }} cryptshot config
|
||||
template: src=cryptshot.conf.j2 dest=/usr/local/etc/cryptshot/{{ target.name }}.conf
|
||||
|
||||
- name: Push {{ target.name }} cryptshot script
|
||||
template: src=cryptshot.sh.j2 dest=/usr/local/bin/cryptshot-{{ target.name }} mode=0755
|
||||
|
||||
- name: Push {{ target.name }} cryptshot service file
|
||||
template: src=cryptshot.service.j2 dest=/etc/systemd/system/cryptshot-{{ target.name }}.service
|
||||
notify:
|
||||
- reload systemd config
|
||||
|
||||
- name: Push {{ target.name }} cryptshot timer file
|
||||
template: src=cryptshot.timer.j2 dest=/etc/systemd/system/cryptshot-{{ target.name }}.timer
|
||||
notify:
|
||||
- reload systemd config
|
||||
- restart cryptshot
|
||||
|
||||
- name: Enable and start cryptshot timer
|
||||
service: name=cryptshot-{{ target.name }}.timer enabled=yes state=started
|
||||
|
|
|
|||
|
|
@ -21,3 +21,20 @@
|
|||
with_items: "{{ cryptshot }}"
|
||||
loop_control:
|
||||
loop_var: target
|
||||
|
||||
- name: Push cryptshot execution script
|
||||
template: src=cryptshot.sh.j2 dest=/usr/local/bin/cryptshot-execute mode=0755
|
||||
|
||||
- name: Push cryptshot service file
|
||||
template: src=cryptshot.service.j2 dest=/etc/systemd/system/cryptshot.service
|
||||
notify:
|
||||
- reload systemd config
|
||||
|
||||
- name: Push cryptshot timer file
|
||||
template: src=cryptshot.timer.j2 dest=/etc/systemd/system/cryptshot.timer
|
||||
notify:
|
||||
- reload systemd config
|
||||
- restart cryptshot
|
||||
|
||||
- name: Enable and start cryptshot timer
|
||||
service: name=cryptshot.timer enabled=yes state=started
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
Description=Cryptshot Backup Service: {{ target.name|capitalize }}
|
||||
Description=Cryptshot Backup Service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/local/bin/cryptshot-{{ target.name }}
|
||||
ExecStart=/usr/local/bin/cryptshot-execute
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
{% for target in cryptshot %}
|
||||
# {{ target.name }}
|
||||
{% for retain in target.retain|sort(attribute='interval') %}
|
||||
/usr/local/bin/backitup -l /usr/local/etc/cryptshot/lastrun/{{ target.name }}.{{ retain.level }} -b "/usr/local/bin/cryptshot -c /usr/local/etc/cryptshot/{{ target.name }}.conf -i {{ retain.level }}" -p {{ retain.level|upper }}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
[Unit]
|
||||
Description=Cryptshot Timer: {{ target.name|capitalize }}
|
||||
Description=Cryptshot Backup Timer
|
||||
|
||||
[Timer]
|
||||
Unit=cryptshot-{{ target.name }}.service
|
||||
Unit=cryptshot.service
|
||||
OnCalendar=hourly
|
||||
Persistent=True
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue