From c9fee6ea132f22c95ffd5d4d2c3fa36565f57973 Mon Sep 17 00:00:00 2001
From: Maxime Bombar <bombar@crans.org>
Date: Tue, 22 Sep 2020 22:23:47 +0200
Subject: [PATCH] ethercalc on new infra

---
 group_vars/reverseproxy.yml                                  | 1 +
 host_vars/ethercalc-srv.adm.crans.org                        | 2 ++
 hosts                                                        | 4 ++++
 plays/ethercalc.yml                                          | 5 +++++
 .../ethercalc/templates/systemd/system/ethercalc.service.j2  | 2 +-
 5 files changed, 13 insertions(+), 1 deletion(-)
 create mode 100644 host_vars/ethercalc-srv.adm.crans.org
 create mode 100755 plays/ethercalc.yml

diff --git a/group_vars/reverseproxy.yml b/group_vars/reverseproxy.yml
index 34857ab4..3ca1356e 100644
--- a/group_vars/reverseproxy.yml
+++ b/group_vars/reverseproxy.yml
@@ -52,6 +52,7 @@ nginx:
     - {from: phabricator.crans.org, to: 172.16.10.116}
     - {from: trackerusercontent.crans.org, to: 172.16.10.116}
     - {from: wiki.crans.org, to: 172.16.10.161}
+    - {from: ethercalc.crans.org, to: "172.16.10.133:8000"}
     #    - {from: mailman.crans.org, to: 10.231.136.180}
     #
     #    # Zamok
diff --git a/host_vars/ethercalc-srv.adm.crans.org b/host_vars/ethercalc-srv.adm.crans.org
new file mode 100644
index 00000000..bd946faf
--- /dev/null
+++ b/host_vars/ethercalc-srv.adm.crans.org
@@ -0,0 +1,2 @@
+ethercalc:
+  ipv4: '172.16.10.133'
diff --git a/hosts b/hosts
index 86ead7ea..55eff40f 100644
--- a/hosts
+++ b/hosts
@@ -33,6 +33,9 @@ frontdaur.adm.crans.org
 [roundcube]
 roundcube-srv.adm.crans.org
 
+[ethercalc]
+ethercalc-srv.adm.crans.org
+
 [horde]
 horde-srv.adm.crans.org
 
@@ -94,6 +97,7 @@ pastemoisa.adm.crans.org
 casouley.adm.crans.org
 kiwi.adm.crans.org
 tracker.adm.crans.org
+ethercalc-srv.adm.crans.org
 
 [ovh_physical]
 sputnik.adm.crans.org
diff --git a/plays/ethercalc.yml b/plays/ethercalc.yml
new file mode 100755
index 00000000..f7a6a03f
--- /dev/null
+++ b/plays/ethercalc.yml
@@ -0,0 +1,5 @@
+#!/usr/bin/env ansible-playbook
+---
+- hosts: ethercalc
+  roles:
+    - ethercalc
diff --git a/roles/ethercalc/templates/systemd/system/ethercalc.service.j2 b/roles/ethercalc/templates/systemd/system/ethercalc.service.j2
index 22fb27e5..7f251cb5 100644
--- a/roles/ethercalc/templates/systemd/system/ethercalc.service.j2
+++ b/roles/ethercalc/templates/systemd/system/ethercalc.service.j2
@@ -11,7 +11,7 @@ RestartSec=3
 User=redis
 Group=redis
 PIDFile=/var/run/ethercalc.pid
-ExecStart=/usr/bin/ethercalc --host 10.231.136.203 --port 8000
+ExecStart=/usr/bin/ethercalc --host {{ ethercalc.ipv4 }} --port 8000
 
 [Install]
 WantedBy=multi-user.target
-- 
GitLab