From 707fb231b8c325dab9e660a099fb9648306a999f Mon Sep 17 00:00:00 2001
From: Vladimir Still <git@vstill.eu>
Date: Fri, 20 Nov 2020 18:12:21 +0100
Subject: [PATCH] ansible: Finalize eval-haskell

---
 ansible/eval-haskell.fi.muni.cz | 65 +++++++++++++++++++++++++++++++++
 ansible/hosts                   |  2 +-
 2 files changed, 66 insertions(+), 1 deletion(-)

diff --git a/ansible/eval-haskell.fi.muni.cz b/ansible/eval-haskell.fi.muni.cz
index d3d795f..10514ca 100644
--- a/ansible/eval-haskell.fi.muni.cz
+++ b/ansible/eval-haskell.fi.muni.cz
@@ -305,6 +305,71 @@
           daemon_reload: '{{eval_service.changed}}'
         loop: '{{range(ib015_workers)}}'
 
+      - name: Copy GHC apt key
+        copy:
+          src: roles/ghc_deb/files/apt-ghc.key
+          dest: /root/apt-ghc.key
+
+      - name: Add apt-key for GHC
+        apt_key:
+          file: /root/apt-ghc.key
+          # gpg --keyserver keyserver.ubuntu.com --export BA3CBA3FFE22B574
+          # gpg --armor --export BA3CBA3FFE22B574
+
+      - name: add GHC repository
+        apt_repository:
+          repo: deb http://downloads.haskell.org/debian buster main
+          filename: ghc
+          state: present
+
+      - name: install cabal 3.2
+        apt:
+          pkg:
+            - cabal-install-3.2
+
+      - name: .cabal exits?
+        stat:
+          path: '/var/frag/ib015_eval_{{item}}/.cabal'
+        loop: '{{range(ib015_workers)}}'
+        register: dot_cabal
+
+      - name: Cabal update
+        command: /opt/cabal/bin/cabal v1-update
+        become: True
+        become_user: 'ib015_eval_{{item}}'
+        when: not dot_cabal.results[item].stat.exists
+        loop: '{{range(ib015_workers)}}'
+
+      - name: Hackage modules
+        command: /opt/cabal/bin/cabal v1-install QuickCheck lens HUnit
+        become: True
+        become_user: 'ib015_eval_{{item}}'
+        loop: '{{range(ib015_workers)}}'
+
+      - name: hsExprTest checkout
+        git:
+          dest: '/var/frag/ib015_eval_{{item}}/hsExprTest'
+          repo: https://github.com/vlstill/hsExprTest.git
+          update: True
+        become: True
+        become_user: 'ib015_eval_{{item}}'
+        loop: '{{range(ib015_workers)}}'
+
+      - name: Insstall hsExprTest
+        command:
+          chdir: '/var/frag/ib015_eval_{{item}}/hsExprTest/src/hs'
+          cmd: /opt/cabal/bin/cabal v1-install
+        become: True
+        become_user: 'ib015_eval_{{item}}'
+        loop: '{{range(ib015_workers)}}'
+
+      - name: Enable user namespaces
+        sysctl:
+          name: kernel.unprivileged_userns_clone
+          value: "1"
+          state: present
+          reload: yes
+
       tags:
         - deploy
 
diff --git a/ansible/hosts b/ansible/hosts
index c105a2c..b933368 100644
--- a/ansible/hosts
+++ b/ansible/hosts
@@ -22,7 +22,7 @@ admin_email=still+admin-paradise@fi.muni.cz
 
 [eval]
 eval-pv264.fi.muni.cz
-eval-haskell.fi.muni.cz ansible_host=172.26.2.46
+eval-haskell.fi.muni.cz
 hesperia.fi.muni.cz
 
 [eval:vars]
-- 
GitLab