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

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"