Browse Source

Replace supervisor with systemd services

Markus Lindenberg 9 years ago
parent
commit
741d2048cd

+ 0 - 1
playbooks/group_vars/mapservers/gluon-collector.yml

@@ -1,6 +1,5 @@
 gluon_collector_http_port: 8080
 gluon_collector_http_address: "[::1]"
-gluon_collector_use_supervisor: true
 gluon_collector_receivers:
 - type: announced
   port: 21214

+ 0 - 3
roles/internal/ffdo.mapserver/handlers/main.yml

@@ -1,5 +1,2 @@
 ---
 # handlers file for map-server
-
-- name: Restart supervisor
-  service: name=supervisor state=restarted

+ 10 - 14
roles/internal/ffdo.mapserver/tasks/main.yml

@@ -1,16 +1,12 @@
 ---
-# tasks file for map-server
-- include_vars: "{{ ansible_os_family }}.yml"
+- name: Install systemd services
+  template: src={{item}}.service.j2 dest=/etc/systemd/system/{{item}}.service
+  with_items:
+  - alfred
+  - batadv-vis
 
-- name: Install necessary packages
-  apt: name={{item}} state=present
-  with_items: "{{mapserver_packages}}"
-
-- name: Create supervisor services
-  when: supervisor_services is defined
-  template: src=supervisor.service.j2 dest=/etc/supervisor/conf.d/{{item.name}}.conf
-  with_items: "{{supervisor_services}}"
-  notify: Restart supervisor
-
-- name: Ensure supervisor is started and enabled
-  service: name=supervisor state=started enabled=yes
+- name: Enable and start systemd services
+  service: name={{item}} enabled=yes state=started
+  with_items:
+  - alfred
+  - batadv-vis

+ 10 - 0
roles/internal/ffdo.mapserver/templates/alfred-master.service.j2

@@ -0,0 +1,10 @@
+[Unit]
+Description=Almighty Lightweight Fact Remote Exchange Daemon - Master
+
+[Service]
+ExecStart=/usr/local/sbin/alfred -m -i alfred0
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+

+ 10 - 0
roles/internal/ffdo.mapserver/templates/batadv-vis.service.j2

@@ -0,0 +1,10 @@
+[Unit]
+Description=batman-adv visualization (vis)
+
+[Service]
+ExecStart=/usr/local/sbin/batadv-vis -s
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+

+ 0 - 3
roles/internal/ffdo.mapserver/templates/supervisor.service.j2

@@ -1,3 +0,0 @@
-[program:{{item.name}}]
-command={{item.command}}
-stdout_logfile=NONE

+ 0 - 2
roles/internal/ffdo.mapserver/vars/Debian.yml

@@ -1,2 +0,0 @@
-mapserver_packages:
-- supervisor

+ 0 - 6
roles/internal/ffdo.supernode/handlers/main.yml

@@ -2,11 +2,5 @@
 # handlers file for ff-supernode
 # In Ubuntu restarting the networking service causes problems.
 # So we use ifdown and ifup to enable changes
-- name: Restart supervisor
-  service: name=supervisor state=restarted
-
 - name: Reboot machine
   shell: reboot
-
-- name: Restart cron
-  service: name=cron state=restarted

+ 0 - 3
roles/internal/ffdo.supernode/tasks/debian.yml

@@ -22,6 +22,3 @@
   apt: name=linux-image-amd64 default_release=wheezy-backports state=latest
   when: ansible_distribution_release == 'wheezy'
   notify: Reboot machine
-
-- name: Start and enable supervisor
-  service: name=supervisor state=started enabled=yes

+ 11 - 8
roles/internal/ffdo.supernode/tasks/main.yml

@@ -20,9 +20,6 @@
   - python3
   - python3-pip
 
-- name: Start and enable supervisor
-  service: name=supervisor state=started enabled=yes
-
 - name: Install crontab to update the blacklist
   cron:
     name: Update blacklist
@@ -32,10 +29,17 @@
 - name: Install verify shell script
   template: src=fastd-blacklist.sh.j2 dest=/etc/fastd/fastd-blacklist.sh mode="u=rwx,g=rx,o=r"
 
-- name: Create supervisor services
-  template: src=supervisor.service.j2 dest=/etc/supervisor/conf.d/{{item.name}}.conf
-  with_items: "{{supervisor_services}}"
-  notify: Restart supervisor
+- name: Install systemd services
+  template: src={{item}}.service.j2 dest=/etc/systemd/system/{{item}}.service
+  with_items:
+  - alfred
+  - batadv-vis
+
+- name: Enable and start systemd services
+  service: name={{item}} enabled=yes state=started
+  with_items:
+  - alfred
+  - batadv-vis
 
 - name: Install ntp.conf
   template: src=ntp.conf.j2 dest=/etc/ntp.conf
@@ -53,4 +57,3 @@
 
 - name: Install nodeinfo cron job
   template: src=nodeinfo.cron.j2 dest=/etc/cron.d/nodeinfo
-  notify: Restart cron

+ 10 - 0
roles/internal/ffdo.supernode/templates/alfred.service.j2

@@ -0,0 +1,10 @@
+[Unit]
+Description=Almighty Lightweight Fact Remote Exchange Daemon
+
+[Service]
+ExecStart=/usr/local/sbin/alfred -i alfred0
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+

+ 10 - 0
roles/internal/ffdo.supernode/templates/batadv-vis.service.j2

@@ -0,0 +1,10 @@
+[Unit]
+Description=batman-adv visualization (vis)
+
+[Service]
+ExecStart=/usr/local/sbin/batadv-vis -s
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
+

+ 0 - 6
roles/internal/ffdo.supernode/vars/main.yml

@@ -40,12 +40,6 @@ radvd_default_interface_options: |
   {
   };
 
-supervisor_services:
-  - name: alfred
-    command: /usr/local/sbin/alfred -i alfred0
-  - name: batadv-vis
-    command: /usr/local/sbin/batadv-vis -s
-
 unbound_configuration:
     - verbosity: 1
     - do-ip4: "yes"

+ 0 - 3
roles/internal/ffmap-backend/handlers/main.yml

@@ -1,5 +1,2 @@
 ---
 # handlers file for ffmap-backend
-
-- name: Restart cron
-  service: name=cron state=restarted

+ 0 - 1
roles/internal/ffmap-backend/tasks/main.yml

@@ -22,4 +22,3 @@
 
 - name: Add ffmap-backend cron entry
   template: src=ffmap-backend.cron.j2 dest=/etc/cron.d/ffmap-backend
-  notify: Restart cron