Initial rough commit to save the code before cleanup

This commit is contained in:
tanshu 2020-04-03 09:24:02 +05:30
commit e0e7b07468
29 changed files with 942 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.retry
.idea

View File

@ -0,0 +1,30 @@
server {
listen 80;
server_name {{ http_host }};
# Allow large attachments
client_max_body_size 128M;
location / {
proxy_pass http://localhost:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /notifications/hub {
proxy_pass http://localhost:3012;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /notifications/hub/negotiate {
proxy_pass http://localhost:8080;
}
}

51
bitwarden/playbook.yml Executable file
View File

@ -0,0 +1,51 @@
#################################################
# DO Community Playbooks: Docker
#################################################
---
- hosts: all
become: true
vars_files:
- vars/default.yml
tasks:
- name: Pull Bitwarden RS Postgres image
docker_image:
name: "{{ container_image }}"
source: pull
- name: Create bitwarden container
docker_container:
name: "{{ container_name }}"
image: "{{ container_image }}"
state: started
env:
DATABASE_URL: "{{ db_url }}"
links: "postgres:db"
published_ports:
- 8080:80
- 3012:3012
volumes:
- /var/lib/bitwarden/data:/data/
- name: Sets Nginx conf file for bitwarden
template:
src: "files/nginx.conf.j2"
dest: "/etc/nginx/sites-available/{{ http_conf }}"
- name: Enables new site
file:
src: "/etc/nginx/sites-available/{{ http_conf }}"
dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
state: link
notify: Reload Nginx
handlers:
- name: Reload Nginx
service:
name: nginx
state: reloaded
- name: Restart Nginx
service:
name: nginx
state: restarted

46
bitwarden/readme.md Normal file
View File

@ -0,0 +1,46 @@
# Docker on Ubuntu 18.04
This playbook will install Docker an Ubuntu 18.04 machine, as explained in the guide on
[How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).
A number of containers will be created with the options specified in the `vars/default.yml` variable file.
## Settings
- `create_containers`: number of containers to create.
- `default_container_name`: default name for new containers.
- `default_container_image`: default image for new containers.
- `default_container_command`: default command to run on new containers.
## Running this Playbook
Quick Steps:
### 1. Obtain the playbook
```shell
git clone https://github.com/do-community/ansible-playbooks.git
cd ansible-playbooks/docker_ubuntu1804
```
### 2. Customize Options
```shell
nano vars/default.yml
```
```yml
#vars/default.yml
---
create_containers: 4
default_container_name: docker
default_container_image: ubuntu
default_container_command: sleep 1d
```
### 3. Run the Playbook
```command
ansible-playbook -l [target] -i [inventory file] -u [remote user] playbook.yml
```
For more information on how to run this Ansible setup, please check this guide: [How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).

View File

@ -0,0 +1,9 @@
---
http_host: "vault.tanshu.com"
http_conf: "vault.tanshu.com.conf"
container_name: bitwarden
container_image: bitwardenrs/server-postgresql
db_url: postgresql://postgres:123456@db:5432/bitwarden

17
gitea/files/nginx.conf.j2 Normal file
View File

@ -0,0 +1,17 @@
server {
listen 80;
server_name {{ http_host }};
# location /_/static {
# alias /path/to/gitea/public;
# }
location / {
proxy_pass http://localhost:3000;
}
}

62
gitea/playbook-pg.yml Executable file
View File

@ -0,0 +1,62 @@
#################################################
# DO Community Playbooks: Docker
#################################################
---
- hosts: all
become: true
vars_files:
- vars/default.yml
tasks:
- name: Add the user 'git' with a specific uid and a primary group of 'admin'
user:
name: "{{ user }}"
comment: Git user
create_home: no
- name: Pull Gitea image
docker_image:
name: "{{ container_image }}"
source: pull
- getent:
database: passwd
key: "{{ user }}"
split: ":"
- name: Create gitea container
docker_container:
name: "{{ container_name }}"
image: "{{ container_image }}"
state: started
env:
USER_UID: "{{ getent_passwd[user][1] }}"
USER_GID: "{{ getent_passwd[user][2] }}"
DB_TYPE: "{{ db_type }}"
DB_HOST: "{{ db_host }}"
DB_NAME: "{{ db_name }}"
DB_USER: "{{ db_user }}"
DB_PASSWD: "{{ db_password }}"
ROOT_URL: "{{ http_url }}"
links:
- "postgres:db"
published_ports:
- "3000:3000"
- "127.0.0.1:2222:22"
volumes:
- /var/lib/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
# - name: Sets Nginx conf file for gitea
# template:
# src: "files/nginx.conf.j2"
# dest: "/etc/nginx/sites-available/{{ http_conf }}"
# - name: Enables new site
# file:
# src: "/etc/nginx/sites-available/{{ http_conf }}"
# dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
# state: link
# notify: Reload Nginx

54
gitea/playbook.yml Executable file
View File

@ -0,0 +1,54 @@
#################################################
# DO Community Playbooks: Docker
#################################################
---
- hosts: all
become: true
vars_files:
- vars/default.yml
tasks:
- name: Add the user 'git' with a specific uid and a primary group of 'admin'
user:
name: "{{ user }}"
comment: Git user
create_home: no
- name: Pull Gitea image
docker_image:
name: "{{ container_image }}"
source: pull
- getent:
database: passwd
key: "{{ user }}"
split: ":"
- name: Create gitea container
docker_container:
name: "{{ container_name }}"
image: "{{ container_image }}"
state: started
env:
USER_UID: "{{ getent_passwd[user][1] }}"
USER_GID: "{{ getent_passwd[user][2] }}"
published_ports:
- "3000:3000"
- "127.0.0.1:2222:22"
volumes:
- /var/lib/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
# - name: Sets Nginx conf file for gitea
# template:
# src: "files/nginx.conf.j2"
# dest: "/etc/nginx/sites-available/{{ http_conf }}"
# - name: Enables new site
# file:
# src: "/etc/nginx/sites-available/{{ http_conf }}"
# dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
# state: link
# notify: Reload Nginx

46
gitea/readme.md Normal file
View File

@ -0,0 +1,46 @@
# Docker on Ubuntu 18.04
This playbook will install Docker an Ubuntu 18.04 machine, as explained in the guide on
[How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).
A number of containers will be created with the options specified in the `vars/default.yml` variable file.
## Settings
- `create_containers`: number of containers to create.
- `default_container_name`: default name for new containers.
- `default_container_image`: default image for new containers.
- `default_container_command`: default command to run on new containers.
## Running this Playbook
Quick Steps:
### 1. Obtain the playbook
```shell
git clone https://github.com/do-community/ansible-playbooks.git
cd ansible-playbooks/docker_ubuntu1804
```
### 2. Customize Options
```shell
nano vars/default.yml
```
```yml
#vars/default.yml
---
create_containers: 4
default_container_name: docker
default_container_image: ubuntu
default_container_command: sleep 1d
```
### 3. Run the Playbook
```command
ansible-playbook -l [target] -i [inventory file] -u [remote user] playbook.yml
```
For more information on how to run this Ansible setup, please check this guide: [How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).

15
gitea/vars/default-pg.yml Normal file
View File

@ -0,0 +1,15 @@
---
http_host: "git.tanshu.com"
http_conf: "git.tanshu.com.conf"
http_url: "https://git.tanshu.com"
container_name: gitea
container_image: gitea/gitea
user: 'git'
db_type: 'postgres'
db_host: 'db:5432'
db_name: 'gitea'
db_user: 'postgres'
db_password: '123456'

9
gitea/vars/default.yml Normal file
View File

@ -0,0 +1,9 @@
---
http_host: "git.tanshu.com"
http_conf: "git.tanshu.com.conf"
http_url: "https://git.tanshu.com"
container_name: gitea
container_image: gitea/gitea
user: 'git'

View File

@ -0,0 +1,16 @@
server {
listen 80;
server_name {{ http_host }};
location / {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Scheme $scheme;
proxy_set_header X-Forwarded-For $remote_addr;
add_header Strict-Transport-Security "max-age=15552000; includeSubDomains" always;
proxy_pass http://localhost:9080;
}
}

71
nextcloud/playbook.yml Executable file
View File

@ -0,0 +1,71 @@
#################################################
# DO Community Playbooks: Docker
#################################################
---
- hosts: all
become: true
vars_files:
- vars/default.yml
tasks:
- name: Pull Nextcloud image
docker_image:
name: "{{ container_image }}"
source: pull
- name: Copy dockerfile
synchronize: src=web dest=/tmp
- name: Build nginx webserver image
docker_image:
name: nextcloud-web
build:
path: /tmp/web/
dockerfile: /tmp/web/Dockerfile
pull: yes
state: present
source: build
- name: Create Nextcloud container
docker_container:
name: "{{ container_name }}"
image: "{{ container_image }}"
state: started
env:
POSTGRES_DB: "{{ db_name }}"
POSTGRES_USER: "{{ db_user }}"
POSTGRES_PASSWORD: "{{ db_pass }}"
POSTGRES_HOST: "{{ db_host }}"
REDIS_HOST: "redis"
links:
- "postgres:db"
- "redis:redis"
published_ports:
- "9000:9000"
volumes:
- /var/lib/nextcloud:/var/www/html
- /dev/urandom:/dev/urandom:ro
- name: Create webserver container
docker_container:
name: cloud-web
image: nextcloud-web
state: started
links:
- "cloud:app"
published_ports:
- "9080:80"
volumes:
- /var/lib/nextcloud:/var/www/html:ro
# - name: Sets Nginx conf file for nextcloud
# template:
# src: "files/nginx.conf.j2"
# dest: "/etc/nginx/sites-available/{{ http_conf }}"
# - name: Enables new site
# file:
# src: "/etc/nginx/sites-available/{{ http_conf }}"
# dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
# state: link

46
nextcloud/readme.md Normal file
View File

@ -0,0 +1,46 @@
# Docker on Ubuntu 18.04
This playbook will install Docker an Ubuntu 18.04 machine, as explained in the guide on
[How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).
A number of containers will be created with the options specified in the `vars/default.yml` variable file.
## Settings
- `create_containers`: number of containers to create.
- `default_container_name`: default name for new containers.
- `default_container_image`: default image for new containers.
- `default_container_command`: default command to run on new containers.
## Running this Playbook
Quick Steps:
### 1. Obtain the playbook
```shell
git clone https://github.com/do-community/ansible-playbooks.git
cd ansible-playbooks/docker_ubuntu1804
```
### 2. Customize Options
```shell
nano vars/default.yml
```
```yml
#vars/default.yml
---
create_containers: 4
default_container_name: docker
default_container_image: ubuntu
default_container_command: sleep 1d
```
### 3. Run the Playbook
```command
ansible-playbook -l [target] -i [inventory file] -u [remote user] playbook.yml
```
For more information on how to run this Ansible setup, please check this guide: [How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).

View File

@ -0,0 +1,11 @@
---
http_host: "cloud.hopsngrains.com"
http_conf: "cloud.hopsngrains.com.conf"
container_name: cloud
container_image: nextcloud:fpm-alpine
db_name: "nextcloud"
db_user: "postgres"
db_pass: "123456"
db_host: "db"

3
nextcloud/web/Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM nginx:alpine
COPY nginx.conf /etc/nginx/nginx.conf

168
nextcloud/web/nginx.conf Normal file
View File

@ -0,0 +1,168 @@
worker_processes auto;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
upstream php-handler {
server app:9000;
}
server {
listen 80;
# Add headers to serve security related headers
# Before enabling Strict-Transport-Security headers please read into this
# topic first.
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
#
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
# Remove X-Powered-By, which is an information leak
fastcgi_hide_header X-Powered-By;
# Path to the root of your installation
root /var/www/html;
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;
# The following rule is only needed for the Social app.
# Uncomment it if you're planning to use this app.
#rewrite ^/.well-known/webfinger /public.php?service=webfinger last;
location = /.well-known/carddav {
return 301 $http_x_scheme://$http_host/remote.php/dav;
}
location = /.well-known/caldav {
return 301 $http_x_scheme://$http_host/remote.php/dav;
}
# set max upload size
client_max_body_size 10G;
fastcgi_buffers 64 4K;
# Enable gzip but do not remove ETag headers
gzip on;
gzip_vary on;
gzip_comp_level 4;
gzip_min_length 256;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;
# Uncomment if your server is build with the ngx_pagespeed module
# This module is currently not supported.
#pagespeed off;
location / {
rewrite ^ /index.php;
}
location ~ ^\/(?:build|tests|config|lib|3rdparty|templates|data)\/ {
deny all;
}
location ~ ^\/(?:\.|autotest|occ|issue|indie|db_|console) {
deny all;
}
location ~ ^\/(?:index|remote|public|cron|core\/ajax\/update|status|ocs\/v[12]|updater\/.+|oc[ms]-provider\/.+)\.php(?:$|\/) {
fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
set $path_info $fastcgi_path_info;
try_files $fastcgi_script_name =404;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $path_info;
# fastcgi_param HTTPS on;
# Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
# Enable pretty urls
fastcgi_param front_controller_active true;
fastcgi_pass php-handler;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^\/(?:updater|oc[ms]-provider)(?:$|\/) {
try_files $uri/ =404;
index index.php;
}
# Adding the cache control header for js, css and map files
# Make sure it is BELOW the PHP block
location ~ \.(?:css|js|woff2?|svg|gif|map)$ {
try_files $uri /index.php$request_uri;
add_header Cache-Control "public, max-age=15778463";
# Add headers to serve security related headers (It is intended to
# have those duplicated to the ones above)
# Before enabling Strict-Transport-Security headers please read into
# this topic first.
#add_header Strict-Transport-Security "max-age=15768000; includeSubDomains; preload;" always;
#
# WARNING: Only add the preload option once you read about
# the consequences in https://hstspreload.org/. This option
# will add the domain to a hardcoded list that is shipped
# in all major browsers and getting removed from this list
# could take several months.
add_header Referrer-Policy "no-referrer" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-Download-Options "noopen" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Permitted-Cross-Domain-Policies "none" always;
add_header X-Robots-Tag "none" always;
add_header X-XSS-Protection "1; mode=block" always;
# Optional: Don't log access to assets
access_log off;
}
location ~ \.(?:png|html|ttf|ico|jpg|jpeg|bcmap)$ {
try_files $uri /index.php$request_uri;
# Optional: Don't log access to other assets
access_log off;
}
}
}

View File

@ -0,0 +1,2 @@
<?php
phpinfo();

View File

@ -0,0 +1,19 @@
server {
listen {{ http_port }};
root /var/www/html;
index index.php index.html index.htm index.nginx-debian.html;
server_name {{ http_host }};
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
}
location ~ /\.ht {
deny all;
}
}

32
postgres/playbook.yml Executable file
View File

@ -0,0 +1,32 @@
#################################################
# DO Community Playbooks: Docker
#################################################
---
- hosts: all
become: true
vars_files:
- vars/default.yml
tasks:
- name: Pull default Postgresql image
docker_image:
name: "{{ postgres_image }}"
source: pull
# Creates the number of containers defined by the variable create_containers, using values from vars file
- name: Create postgres container
docker_container:
name: "{{ postgres_name }}"
image: "{{ postgres_image }}"
state: started
env:
POSTGRESQL_USER: "{{ pg_user }}"
POSTGRESQL_PASSWORD: "{{ pg_password }}"
POSTGRESQL_DATABASE: 'postgres'
PGDATA: '/var/lib/postgresql/data/pgdata'
exposed_ports:
- 5432
published_ports:
- 5432:5432
volumes:
- /var/lib/postgresql/data:/var/lib/postgresql/data

46
postgres/readme.md Normal file
View File

@ -0,0 +1,46 @@
# Docker on Ubuntu 18.04
This playbook will install Docker an Ubuntu 18.04 machine, as explained in the guide on
[How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).
A number of containers will be created with the options specified in the `vars/default.yml` variable file.
## Settings
- `create_containers`: number of containers to create.
- `default_container_name`: default name for new containers.
- `default_container_image`: default image for new containers.
- `default_container_command`: default command to run on new containers.
## Running this Playbook
Quick Steps:
### 1. Obtain the playbook
```shell
git clone https://github.com/do-community/ansible-playbooks.git
cd ansible-playbooks/docker_ubuntu1804
```
### 2. Customize Options
```shell
nano vars/default.yml
```
```yml
#vars/default.yml
---
create_containers: 4
default_container_name: docker
default_container_image: ubuntu
default_container_command: sleep 1d
```
### 3. Run the Playbook
```command
ansible-playbook -l [target] -i [inventory file] -u [remote user] playbook.yml
```
For more information on how to run this Ansible setup, please check this guide: [How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).

View File

@ -0,0 +1,7 @@
---
postgres_name: postgres
postgres_image: postgres
pg_user: postgres
pg_password: '123456'
data_location: /var/lib/postgresql/data

18
redis/playbook.yml Executable file
View File

@ -0,0 +1,18 @@
---
- hosts: all
become: true
vars_files:
- vars/default.yml
tasks:
- name: Pull default redis image
docker_image:
name: "{{ container_image }}"
source: pull
- name: Create redis container
docker_container:
name: "{{ container_name }}"
image: "{{ container_image }}"
state: started

46
redis/readme.md Normal file
View File

@ -0,0 +1,46 @@
# Docker on Ubuntu 18.04
This playbook will install Docker an Ubuntu 18.04 machine, as explained in the guide on
[How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).
A number of containers will be created with the options specified in the `vars/default.yml` variable file.
## Settings
- `create_containers`: number of containers to create.
- `default_container_name`: default name for new containers.
- `default_container_image`: default image for new containers.
- `default_container_command`: default command to run on new containers.
## Running this Playbook
Quick Steps:
### 1. Obtain the playbook
```shell
git clone https://github.com/do-community/ansible-playbooks.git
cd ansible-playbooks/docker_ubuntu1804
```
### 2. Customize Options
```shell
nano vars/default.yml
```
```yml
#vars/default.yml
---
create_containers: 4
default_container_name: docker
default_container_image: ubuntu
default_container_command: sleep 1d
```
### 3. Run the Playbook
```command
ansible-playbook -l [target] -i [inventory file] -u [remote user] playbook.yml
```
For more information on how to run this Ansible setup, please check this guide: [How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).

4
redis/vars/default.yml Normal file
View File

@ -0,0 +1,4 @@
---
container_name: redis
container_image: redis:alpine

View File

@ -0,0 +1,12 @@
server {
listen 80;
server_name {{ http_host }};
location / {
proxy_pass http://localhost:8888;
}
}

48
trilium/playbook.yml Executable file
View File

@ -0,0 +1,48 @@
#################################################
# DO Community Playbooks: Docker
#################################################
---
- hosts: all
become: true
vars_files:
- vars/default.yml
tasks:
- name: Pull default Trilium image
docker_image:
name: "{{ container_image }}"
source: pull
# Creates the number of containers defined by the variable create_containers, using values from vars file
- name: Create Trilium container
docker_container:
name: "{{ container_name }}"
image: "{{ container_image }}"
state: started
published_ports:
- 127.0.0.1:8888:8080
volumes:
- /var/lib/trilium:/root/trilium-data
- name: Sets Nginx conf file for trilium
template:
src: "files/nginx.conf.j2"
dest: "/etc/nginx/sites-available/{{ http_conf }}"
- name: Enables new site
file:
src: "/etc/nginx/sites-available/{{ http_conf }}"
dest: "/etc/nginx/sites-enabled/{{ http_conf }}"
state: link
notify: Reload Nginx
handlers:
- name: Reload Nginx
service:
name: nginx
state: reloaded
- name: Restart Nginx
service:
name: nginx
state: restarted

46
trilium/readme.md Normal file
View File

@ -0,0 +1,46 @@
# Docker on Ubuntu 18.04
This playbook will install Docker an Ubuntu 18.04 machine, as explained in the guide on
[How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).
A number of containers will be created with the options specified in the `vars/default.yml` variable file.
## Settings
- `create_containers`: number of containers to create.
- `default_container_name`: default name for new containers.
- `default_container_image`: default image for new containers.
- `default_container_command`: default command to run on new containers.
## Running this Playbook
Quick Steps:
### 1. Obtain the playbook
```shell
git clone https://github.com/do-community/ansible-playbooks.git
cd ansible-playbooks/docker_ubuntu1804
```
### 2. Customize Options
```shell
nano vars/default.yml
```
```yml
#vars/default.yml
---
create_containers: 4
default_container_name: docker
default_container_image: ubuntu
default_container_command: sleep 1d
```
### 3. Run the Playbook
```command
ansible-playbook -l [target] -i [inventory file] -u [remote user] playbook.yml
```
For more information on how to run this Ansible setup, please check this guide: [How to Use Ansible to Install and Set Up Docker on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-docker-on-ubuntu-18-04).

6
trilium/vars/default.yml Normal file
View File

@ -0,0 +1,6 @@
---
container_name: trilium
container_image: zadam/trilium:latest
http_host: "notes.tanshu.com"
http_conf: "notes.tanshu.com.conf"