[sd-timers crons] typos and errors
parent
b4a878fff8
commit
77f16ac474
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
- name: Adding services to send status emails
|
- name: Adding services to send status emails
|
||||||
template:
|
template:
|
||||||
src: etc/systemd/system/{{ item }}@.service.j2
|
src: "etc/systemd/system/{{ item }}@.service.j2"
|
||||||
dst: /etc/systemd/system/{{ item }}@.service
|
dest: "/etc/systemd/system/{{ item }}@.service"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
loop:
|
loop:
|
||||||
|
@ -11,26 +11,31 @@
|
||||||
|
|
||||||
- name: Deploy the status-sender
|
- name: Deploy the status-sender
|
||||||
template:
|
template:
|
||||||
src: var/local/sendstatusmail.sh.j2
|
src: "var/local/sendstatusmail.sh.j2"
|
||||||
dst: /var/local/sendstatusmail.sh
|
dest: "/var/local/sendstatusmail.sh"
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: '0500'
|
mode: '0500'
|
||||||
|
|
||||||
- name: Install sdcron timers
|
- name: Install sdcron timers
|
||||||
template:
|
template:
|
||||||
src: etc/systemd/system/sdcron.timer.j2
|
src: "etc/systemd/system/sdcron.timer.j2"
|
||||||
dst: etc/systemd/system/{{ item.name }}.timer
|
dest: "/etc/systemd/system/{{ item.name }}.timer"
|
||||||
loop: "{{ sdcron.tasks }}"
|
loop: "{{ sdcron.tasks }}"
|
||||||
|
|
||||||
- name: Install sdcron services
|
- name: Install sdcron services
|
||||||
template:
|
template:
|
||||||
src: etc/systemd/system/sdcron.service.j2
|
src: "etc/systemd/system/sdcron.service.j2"
|
||||||
dst: etc/systemd/system/{{ item.name }}.service
|
dest: "/etc/systemd/system/{{ item.name }}.service"
|
||||||
loop: "{{ sdcron.tasks }}"
|
loop: "{{ sdcron.tasks }}"
|
||||||
|
|
||||||
|
- name: Reload sd daemons
|
||||||
|
systemd:
|
||||||
|
daemon_reload: true
|
||||||
|
|
||||||
- name: Enable sdcron timers
|
- name: Enable sdcron timers
|
||||||
systemd:
|
systemd:
|
||||||
name: {{ item.name }}.timer
|
name: "{{ item.name }}.timer"
|
||||||
enabled: yes
|
enabled: yes
|
||||||
|
state: "started"
|
||||||
loop: "{{ sdcron.tasks }}"
|
loop: "{{ sdcron.tasks }}"
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Service for {{ item.name }}
|
Description=Service for {{ item.name }}
|
||||||
OnFailure=failuremail@%n.service
|
OnFailure=failuremail@%N.service
|
||||||
OnSuccess=successmail@%n.service
|
# TODO: comprendre pourquoi OnSuccess n'est pas reconnu par systemd (malgré systemd.unit(5))
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart={{ item.command }}
|
ExecStart={{ item.command }}
|
||||||
|
ExecStartPost=/usr/bin/systemctl start successmail@%N.service
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ status="${1}"
|
||||||
service_name="${2}"
|
service_name="${2}"
|
||||||
smtp_rcpt="nounous@crans.org"
|
smtp_rcpt="nounous@crans.org"
|
||||||
|
|
||||||
/usr/bin/sendmail -t <<EOF
|
/usr/sbin/sendmail -t <<EOF
|
||||||
To: ${smtp_rcpt}
|
To: ${smtp_rcpt}
|
||||||
Subject: ${status} of the service ${service_name}.
|
Subject: ${status} of the service ${service_name}.
|
||||||
Date: $(date -R)
|
Date: $(date -R)
|
||||||
|
|
Loading…
Reference in New Issue