first commit

This commit is contained in:
meaz 2021-05-11 22:30:26 +02:00
commit 3dd5b71cdd
Signed by: meaz
GPG Key ID: CD7A47B2F1ED43B4
13 changed files with 293 additions and 0 deletions

19
LICENSE Normal file
View File

@ -0,0 +1,19 @@
MIT License Copyright (c) 2021 "Stichting Disroot.org"
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

9
Playbooks/dashboard.yml Normal file
View File

@ -0,0 +1,9 @@
---
- hosts: dashboard
roles:
- nginx
- dashboard
vars_files:
- ../defaults/main.yml

22
README.md Normal file
View File

@ -0,0 +1,22 @@
# Dashboard - Ansible Role
This role covers deployment and configuration of Dashboard. This role is released under MIT Licence and we give no warranty for this piece of software. Currently supported OS - Debian.
You can deploy test instance using `Vagrantfile` attached to the role.
`vagrant up`
`ansible-playbook -b Playbooks/cryptpad.yml`
Then you can access dashboard from your computer on http://192.168.33.49
## Playbook
The playbook includes nginx role and deploys entire stack needed to run Dashboard. Additional role is also available in the Ansible roles repos in git.
## CHANGELOG
- **14.04.2021** - Vagrant deployment
- Make the role deployadable on vagrant
- Update readme
- Add licence

20
Vagrantfile vendored Normal file
View File

@ -0,0 +1,20 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
#config.ssh.insert_key = false
config.vm.define "dashboard" do |dashboard|
dashboard.vm.box = "generic/debian10"
dashboard.vm.provider :libvirt do |libvirt|
libvirt.memory = 256
end
dashboard.vm.network "forwarded_port", guest: 80, host: 8884, host_ip: "192.168.33.49"
dashboard.vm.network "forwarded_port", guest: 443, host: 4444, host_ip: "192.168.33.49"
dashboard.vm.network "forwarded_port", guest: 8080, host: 8081, host_ip: "192.168.33.49"
dashboard.vm.network "private_network", ip: "192.168.33.49"
end
end

51
defaults/main.yml Normal file
View File

@ -0,0 +1,51 @@
---
dash_user: 'www-data'
dash_group: 'www-data'
dash_static_rootdir: '/var/www/dashboard'
dash_companyname: 'My example name'
dash_dirname: 'example'
dash_website_link: 'example.org'
dash_asset_host_dirname: 'files/assets'
dash_asset_dirname: 'assets' # change this according to the folder's name you have in files/
dash_bgimage: 'bgimage.jpg'
dash_logo: 'logo.png'
dash_font_awesome_version: 5.15.3
dash_style_bgimage: "/{{ dash_asset_dirname }}/{{ dash_bgimage }}"
# Add and adjust services as needed
dash_services:
- name: 'mail'
link: 'mail.example.org'
icon: 'fa-envelope'
caption: 'E-MAIL'
deploy: 'true'
- name: 'cloud'
link: 'cloud.example.org'
icon: 'fa-cloud'
caption: 'CLOUD'
deploy: 'true'
- name: 'pod'
link: 'pod.example.org'
icon: 'fa-asterisk'
caption: 'DIASPORA'
deploy: 'true'
#nginx
nginx_default_vhost: 'dashboard'
nginx_default_vhost_ssl: 'dashboard'
nginx_www_dir: '/var/www/{{ nginx_default_vhost }}/'
nginx_vhosts:
- name: 'dashboard'
template: 'base'
proto: 'http'
listen: '80'
server: 'localhost'
root: '{{ dash_dirname }}'
index: 'index.html'
use_access_log: 'true'
use_error_log: 'true'
nginx_error_log_level: 'warn'
state: 'enable'
letsencrypt: 'false'

BIN
files/assets/bgimage.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
files/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

18
tasks/git.yml Normal file
View File

@ -0,0 +1,18 @@
---
- name: "[GIT] - Create folder"
file:
path: "{{ dash_static_rootdir }}"
owner: "{{ dash_user }}"
group: "{{ dash_group }}"
state: directory
recurse: yes
- name: '[GIT] - Clone git repo'
git:
repo: https://github.com/FortAwesome/Font-Awesome.git
dest: '{{ dash_static_rootdir }}/{{ dash_dirname }}/{{ dash_asset_dirname }}/font-awesome-{{ dash_font_awesome_version }}'
force: yes
version: "{{ dash_font_awesome_version }}"
become: yes
become_user: "{{ dash_user }}"

33
tasks/install.yml Normal file
View File

@ -0,0 +1,33 @@
---
- name: "[INSTALL] - Deploy dashboard HTML"
template:
src: index.html.j2
dest: "{{ dash_static_rootdir }}/{{ dash_dirname }}/index.html"
owner: "{{ dash_user }}"
group: "{{ dash_group }}"
mode: 0644
- name: "[INSTALL] - Deploy dashboard CSS"
template:
src: styles.css.j2
dest: "{{ dash_static_rootdir }}/{{ dash_dirname }}/styles.css"
owner: "{{ dash_user }}"
group: "{{ dash_group }}"
mode: 0644
- name: "[INSTALL] - Deploy dashboard Mobile CSS"
template:
src: mobile.css.j2
dest: "{{ dash_static_rootdir }}/{{ dash_dirname }}/mobile.css"
owner: "{{ dash_user }}"
group: "{{ dash_group }}"
mode: 0644
- name: "[INSTALL] - Copy assets folder files"
copy:
src: "{{ dash_asset_host_dirname }}/"
dest: "{{ dash_static_rootdir }}/{{ dash_dirname }}/{{ dash_asset_dirname }}"
owner: "{{ dash_user }}"
group: "{{ dash_group }}"
mode: 0644

7
tasks/main.yml Normal file
View File

@ -0,0 +1,7 @@
---
- name: Clone git repo
include: git.yml
- name: Install dash
include: install.yml

29
templates/index.html.j2 Normal file
View File

@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="styles.css" media="screen" />
<link rel="stylesheet" type="text/css" href="mobile.css" media="handheld" />
<link rel="stylesheet" href="/{{ dash_asset_dirname }}/font-awesome-{{ dash_font_awesome_version }}/css/all.min.css">
<title>{{ dash_companyname }}'s Dashboard</title>
</head>
<body>
<a href="https://{{ dash_website_link}}">
<div id="logo">
</div>
</a>
<div id="wrapper">
<div id="all-links">
{% for item in dash_services %}
{% if item.deploy == 'true' %}
<a class="link" href="{{ item.link }}" target=_blank>
<div id="link-to-{{ item.name }}" class="img-link">
<i class="fa {{ item.icon }} fa-5x" aria-hidden="true"></i>
<p class="link-text"> {{ item.caption }} </p>
</div>
</a>
{% endif %}
{% endfor %}
</div>
</div>
</body>
</html>

28
templates/mobile.css.j2 Normal file
View File

@ -0,0 +1,28 @@
body {
background-color: #123456;
}
#all-links {
position: relative;
width: 600;
top: 25%;
left: 25%;
}
.img-link {
height: 200px;
width: 200px;
}
.link {
color: #fff;
font-family: "Monospace";
font-size: 1.3em;
text-decoration:none;
margin: 40px;
}
.link-text {
padding: 20px;
padding-top: 2%;
}

57
templates/styles.css.j2 Normal file
View File

@ -0,0 +1,57 @@
body {
background-color: #123456;
background: url("{{ dash_style_bgimage }}") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#wrapper {
width: 800px;
margin-left: auto;
margin-right: auto;
margin-top: 130px;
}
#logo {
background: url("/{{ dash_asset_dirname }}/{{ dash_logo }}") no-repeat;
background-size: auto 45px;
height: 45px;
margin-top: 20px;
margin-left: 15%;
}
a {
outline: 0;
}
#all-links {
width: 100%;
}
.img-link {
height: 100px;
width: 100px;
display: inline-block;
}
.link {
color: #fff;
font-family: "Source-Sans-Pro",sans-serif;
font-size: 0.7em;
text-decoration:none;
}
.link:hover {
color: #a33;
}
.link-text {
padding: 0px;
position: relative;
}
.img-link {
margin: 30px;
}