Merge branch 'statping' into 'newinfra'

Init statping role

See merge request nounous/ansible!132
certbot_on_virtu
erdnaxe 2020-12-28 14:22:19 +01:00
commit f3413d6a84
5 changed files with 69 additions and 0 deletions

View File

@ -88,3 +88,6 @@
# Monitor logs with mtail
#- hosts: thot.adm.crans.org
# roles: ["mtail"]
- hosts: sputnik.adm.crans.org
roles: ["statping"]

View File

@ -0,0 +1,10 @@
---
- name: Restart nginx
service:
name: nginx
state: restarted
- name: Restart statping
service:
name: statping
state: restarted

View File

@ -0,0 +1,36 @@
---
- name: Install statping
unarchive:
src: https://github.com/statping/statping/releases/download/v0.90.74/statping-linux-amd64.tar.gz
dest: /usr/local/bin/
remote_src: yes
- name: Create statping user
user:
create_home: yes
home: /var/lib/statping
system: yes
state: present
password: "!"
update_password: always
name: statping
- name: Install statping systemd unit
template:
src: "systemd/system/statping.service.j2"
dest: "/etc/systemd/system/statping.service"
mode: 0644
notify: Restart statping
- name: Load and activate statping systemd unit
systemd:
name: statping.service
daemon_reload: true
enabled: true
state: started
- name: Indicate role in motd
template:
src: update-motd.d/05-service.j2
dest: /etc/update-motd.d/05-statping
mode: 0755

View File

@ -0,0 +1,17 @@
{{ ansible_header | comment }}
[Unit]
Description=Statping Server
After=network.target
After=systemd-user-sessions.service
After=network-online.target
[Service]
Type=simple
User=statping
Restart=always
ExecStart=/usr/local/bin/statping
WorkingDirectory=/var/local/statping
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,3 @@
#!/usr/bin/tail +14
{{ ansible_header | comment }}
> Statping a été déployé sur cette machine. Voir /var/local/statping/.