Wekan deployed using ansible

This commit is contained in:
tanshu 2020-05-04 17:04:48 +05:30
parent 02cc1dafe5
commit 7c16fb5914
4 changed files with 135 additions and 0 deletions

18
wekan/files/nginx.conf.j2 Normal file
View File

@ -0,0 +1,18 @@
server {
listen 80;
server_name {{ http_host }};
# Allow large attachments
client_max_body_size 128M;
location / {
proxy_pass http://localhost:8881;
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;
}
}

59
wekan/playbook.yml Executable file
View File

@ -0,0 +1,59 @@
#################################################
# DO Community Playbooks: Docker
#################################################
---
- hosts: all
become: true
vars_files:
- vars/default.yml
tasks:
- name: Pull Wekan image
docker_image:
name: "{{ container_image }}"
source: pull
- name: Create bitwarden container
docker_container:
name: "{{ container_name }}"
image: "{{ container_image }}"
state: started
restart_policy: "unless-stopped"
env:
MONGO_URL: "{{ db_url }}"
ROOT_URL: "{{ root_url }}"
MAIL_URL: "{{ mail_url }}"
MAIL_FROM: "{{ mail_from }}"
links: "mongo:db"
published_ports:
- 127.0.0.1:8881:8080
volumes:
- /var/lib/bitwarden/data:/data/
- name: Check if Nginx conf file exists
stat: path="/etc/nginx/sites-available/{{ http_conf }}"
register: status
- name: No need to reload Nginx
debug: msg= {{ "No need to reload Nginx as sites-available entries have already been created" }}
- name: Set Nginx conf file
when: status.stat.exists == false
template:
src: "files/nginx.conf.j2"
dest: "/etc/nginx/sites-available/{{ http_conf }}"
- name: Enable new site
when: status.stat.exists == false
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

46
wekan/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).

12
wekan/vars/default.yml Normal file
View File

@ -0,0 +1,12 @@
---
http_host: "kanban.hopsngrains.com"
http_conf: "kanban.hopsngrains.com.conf"
container_name: wekan
container_image: wekanteam/wekan
db_url: mongodb://db:27017/wekan
root_url: https://kanban.hopsngrains.com
mail_url: smtp://<mail_url>:25/?ignoreTLS=true&tls={rejectUnauthorized:false}
mail_from: Wekan Notifications <noreply.wekan@kanban.hopsngrains.com>