Jelajahi Sumber

[excalidraw] Add new role

Colin Powell 3 tahun lalu
induk
melakukan
b42c8b6419

+ 5 - 0
ansible/hosts

@@ -24,6 +24,7 @@ kibana1.local
 redis1-master.local
 hauk1.local
 icecast1.local
+excalidraw1.local
 test2.local
 
 [physical]
@@ -88,6 +89,7 @@ redis1-master.local
 hauk1.local
 bastion1.local ansible_become=true
 icecast1.local
+excalidraw1.local
 
 [mailinabox]
 box.unbl.ink
@@ -132,6 +134,9 @@ hauk1.local
 [search]
 searx1.local
 
+[draw]
+excalidraw1.local
+
 [rss]
 miniflux1.local
 

+ 6 - 0
ansible/playbook.yml

@@ -156,6 +156,11 @@
     - role: nginx
     - role: tandoor
 
+- hosts: draw
+  roles:
+    - role: nginx
+    - role: excalidraw
+
 - hosts: test
   roles:
     - role: direnv
@@ -185,3 +190,4 @@
     - role: pbp
     - role: fifteen5
     - role: photoview
+    - role: excalidraw

+ 4 - 0
ansible/roles/excalidraw/files/nginx-location.conf

@@ -0,0 +1,4 @@
+location /excalidraw {
+    root   /usr/local/www/;
+    index  index.html index.htm;
+}

+ 39 - 0
ansible/roles/excalidraw/tasks/main.yml

@@ -0,0 +1,39 @@
+---
+- name: Dependencies installed
+  community.general.pkgng:
+    name: git-tiny,yarn
+    state: latest
+  tags:
+    - build
+
+- name: Source folder exists
+  file: path=/usr/local/src mode=0755 state=directory
+  tags:
+    - build
+
+- name: Excalidraw source fetched
+  git:
+    repo: "https://github.com/excalidraw/excalidraw.git"
+    dest: /usr/local/src/excalidraw
+    force: yes
+    accept_hostkey: yes
+    update: yes
+  tags:
+    - build
+
+- name: Yarn dependencies installed
+  shell:
+    chdir: /usr/local/src/excalidraw
+    cmd: yarn build
+
+- name: Excalidraw build artifacts installed
+  shell:
+    cmd: mkdir -p /usr/local/www/excalidraw && cp -r /usr/local/src/excalidraw/build/* /usr/local/www/excalidraw/
+  tags:
+    - build
+
+- name: Nginx config file installed
+  ansible.builtin.copy:
+    src: nginx-location.conf
+    dest: /usr/local/etc/nginx/locations/
+  notify: Nginx restarted