Tobias Südkamp 7 gadi atpakaļ
vecāks
revīzija
80ef9ff720
3 mainītis faili ar 158 papildinājumiem un 24 dzēšanām
  1. 27 10
      debug.html
  2. 7 14
      index.html.j2
  3. 124 0
      ansible/main.yml

+ 27 - 10
debug.html

@@ -6,7 +6,7 @@
   <meta name="viewport" content="width=device-width, initial-scale=1">
   <title>Freifunk Münsterland - Karten</title>
   <link rel="stylesheet" href="css/bootstrap.min.css">
-  <link rel="stylesheet" href="css/ffms.css">
+  <link rel="stylesheet" href="ffms.css">
 </head>
 <body>
 	<div class="container">
@@ -62,28 +62,45 @@
               <td><a href="mapXX/"> XX - name</a></td>
             </tr> -->
             <tr>
-              <td><a href="map01/">01 - Münster</a> </td>
+              <td>
+                  <a href="map01/">01 - Münster</a> &ensp;&ndash;&ensp;
+                  <a class="ffms-muted" href="domaene01">Firmware </a>
+                  </td>
             </tr>
             <tr>
-              <td><a href="map05/">05 - Münster Süd</a> </td>
+              <td><a href="map05/">05 - Münster Süd</a> &mdash;
+                  <a class="ffms-muted" align="right" href="domaene01">Firmware </a>
+                  </td>
             </tr>
             <tr>
-              <td><a href="map06/">06 - Westmünsterland</a> </td>
+              <td><a href="map06/">06 - Westmünsterland</a> &mdash;
+                  <a class="ffms-muted" align="right" href="domaene01">Firmware </a>
+                  </td>
             </tr>
             <tr>
-              <td><a href="map07/">07 - Telgte</a> </td>
+              <td><a href="map07/">07 - Telgte</a> &mdash;
+                  <a class="ffms-muted" align="right" href="domaene01">Firmware </a>
+                  </td>
             </tr>
             <tr>
-              <td><a href="map08/">08 - Gescher</a> </td>
+              <td><a href="map08/">08 - Gescher</a> &mdash;
+                  <a class="ffms-muted" align="right" href="domaene01">Firmware </a>
+                  </td>
             </tr>
             <tr>
-              <td><a href="map09/">09 - Stadtlohn</a> </td>
+              <td><a href="map09/">09 - Stadtlohn</a> &mdash;
+                  <a class="ffms-muted" align="right" href="domaene01">Firmware </a>
+                  </td>
             </tr>
             <tr>
-              <td><a href="map10/">10 - Multidomänen-L2TP-Test</a> </td>
+              <td><a href="map10/">10 - Multidomänen-L2TP-Test</a> &mdash;
+                  <a class="ffms-muted" align="right" href="domaene01">Firmware </a>
+                  </td>
             </tr>
             <tr>
-              <td><a href="map11/">11 - Bocholt</a> </td>
+              <td><a href="map11/">11 - Bocholt</a> &mdash;
+                  <a class="ffms-muted" align="right" href="domaene01">Firmware </a>
+                  </td>
             </tr>
             <tr>
               <td><a href="map12/">12 - Dülmen</a> </td>
@@ -270,7 +287,7 @@
             </tr>
             -->
             <tr>
-                <td><a Community href="map_Borken/">Community Borken</a><br/> <span class="text-muted">Domänen:</span>  
+                <td><a Community href="map_Borken/">Community Borken</a><br/> <span class="ffms-muted">Domänen:</span>  
                     <a class="text-muted" href="map26/">26</a>
                 </td>
             </tr>

+ 7 - 14
index.html.j2

@@ -4,15 +4,15 @@
   <title>{{freifunk.name}} - Karten</title>
   <meta charset="utf-8">
   <meta name="viewport" content="width=device-width, initial-scale=1">
-  <link rel="stylesheet" href="css/bootstrap.min.css">
-  <link rel="stylesheet" href="css/ffms.css">
+  <link rel="stylesheet" href="temp/css/bootstrap.min.css">
+  <link rel="stylesheet" href="temp/css/ffms.css">
 </head>
 <body>
 	<div class="container">
 	  <div class="page-header">
     <div class="row">
       <div class="col-md-2 col-sm-3">
-        <img id="ffms-logo" src="logo.svg" class="img" alt="Logo Freifunk Münsterland">
+        <img id="ffms-logo" src="temp/logo.svg" class="img" alt="Logo Freifunk Münsterland">
       </div>
       <div class="col-md-10 col-sm-9">
         <h2>Karten - {{freifunk.name}}
@@ -56,10 +56,7 @@
             </tr>
           </thead>
           <tbody>
-            <!-- Alle Domänen einfügen 
-            <tr>
-              <td><a href="mapXX/"> XX - name</a></td>
-            </tr> -->
+            <!-- Alle Domänen einfügen -->
 {% for domaene in domaenen|dictsort %}
             <tr>
               <td>
@@ -84,11 +81,7 @@
             </tr>
           </thead>
           <tbody>
-            <!-- Alle Communities einfügen 
-            <tr>
-                <td><a href=""> </a></td>
-            </tr>
-            -->
+            <!-- Alle Communities einfügen -->
 {% for community in communities %}
 {% if community != "None" %}
             <tr>
@@ -113,8 +106,8 @@
     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
     <!-- Include all compiled plugins (below), or include individual files as needed -->
     <!-- optional via CDN: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"  </script> -->
-    <script src="js/bootstrap.min.js"></script> 
-    <script src="js/search.js"></script>
+    <script src="temp/js/bootstrap.min.js"></script> 
+    <script src="temp/js/search.js"></script>
     <script>
         function myScroll(my) {
         $('html, body').animate({

+ 124 - 0
ansible/main.yml

@@ -0,0 +1,124 @@
+- name: install nginx
+  apt:
+    pkg: "{{ item }}"
+    update_cache: no
+    state: latest
+  with_items:
+    - nginx
+
+- name: create letsencrypt directory
+  file: name=/var/www/letsencrypt state=directory
+
+- name: Install default nginx site for letsencrypt requests and https rewrite
+  template:
+    src: templates/default.j2
+    dest: /etc/nginx/sites-available/default
+  register: gendefconf
+
+- name: Activate default nginx site
+  file: src=/etc/nginx/sites-available/default dest=/etc/nginx/sites-enabled/default state=link
+  register: actdefconf
+
+- name: Reload nginx to activate letsencrypt site
+  service: name=nginx state=restarted
+  when: gendefconf.changed or actdefconf.changed
+
+- name: acme install
+  shell: wget -O -  https://get.acme.sh | sh
+  args:
+    creates: /root/.acme.sh/acme.sh
+
+- name: Create certificate
+  shell: /root/.acme.sh/acme.sh --issue -d {{inventory_hostname_short}}.{{freifunk.domain}} -w /var/www/letsencrypt
+  args:
+    creates: /root/.acme.sh/{{inventory_hostname_short}}.{{freifunk.domain}}/ca.cer
+
+- name: install cert to Nginx
+  shell: /root/.acme.sh/acme.sh --installcert -d {{inventory_hostname_short}}.{{freifunk.domain}} --keypath "/etc/ssl/key.pem" --fullchainpath "/etc/ssl/fullchain.pem" --reloadcmd "systemctl restart nginx"
+  args:
+    creates: /etc/ssl/certs/key.pem
+  
+- name: Generate dhparams
+  shell: openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
+  args:
+    creates: /etc/ssl/certs/dhparam.pem
+
+- name: Create nginx caching dir
+  file:
+    path: /opt/hopglass_nginx_cache
+    state: directory
+
+- name: Create nginx caching dirs for tiles caching
+  file:
+    path: "{{item.path}}"
+    state: directory
+  with_items:
+    - "{{nginx_tiles_cache.cache_locations}}"
+  when: nginx_tiles_cache is defined and "cache_locations" in nginx_tiles_cache
+
+- name: Define cache in nginx.conf
+  lineinfile:
+    regexp: "^[\t ]*proxy_cache_path.*hopglass"
+    line: "\tproxy_cache_path /opt/hopglass_nginx_cache levels=1:2 keys_zone=hopglass:10m inactive=1h max_size=1g;"
+    insertafter: "^[\t ]*http[\t ]*\\{"
+    dest: /etc/nginx/nginx.conf
+  notify:
+    - restart nginx
+
+- name: Define include for tiles cache in nginx.conf
+  lineinfile:
+    regexp: "^[\t ]*include /etc/nginx/tiles_cache.conf;"
+    line: "\tinclude /etc/nginx/tiles_cache.conf;"
+    insertafter: "^[\t ]*http[\t ]*\\{"
+    dest: /etc/nginx/nginx.conf
+  notify:
+    - restart nginx
+  when: nginx_tiles_cache is defined
+
+- name: Deploy tiles_cache.conf
+  template:
+    src: tiles_cache.conf.j2
+    dest: /etc/nginx/tiles_cache.conf
+  notify:
+    - restart nginx
+  when: nginx_tiles_cache is defined
+
+- name: Deploy default ssl nginx site
+  template:
+    src: default_ssl.j2
+    dest: /etc/nginx/sites-available/default_ssl
+  notify:
+    - restart nginx
+
+- name: Aktivate default ssl nginx site
+  file: src=/etc/nginx/sites-available/default_ssl dest=/etc/nginx/sites-enabled/default_ssl state=link
+  register: actsslconf
+
+- name: Reload nginx to activate letsencrypt site
+  service: name=nginx state=restarted
+  when: actsslconf.changed
+
+- name: Create nginx caching dir
+  file:
+    path: /var/www/html/temp/
+    state: directory
+
+- name: Clone bootstrap and css files
+  git: repo=https://github.com/FreiFunkMuenster/nodesmap-page.git dest=/var/www/html/temp/ force=yes
+
+- name: Generate index.html
+  template:
+    src: index.html.j2
+    dest: /var/www/html/index.html
+
+- name: link hopglass
+  file:
+    src: /opt/hopglass/client/build
+    dest: /var/www/html/map
+    state: link
+
+- name: link hwpics
+  file:
+    src: /opt/hopglass/hwpics/nodes
+    dest: /var/www/html/hwpics
+    state: link