From 7c16fb5914cefbd6cb58a76ea94f1378431dbf0f Mon Sep 17 00:00:00 2001 From: tanshu Date: Mon, 4 May 2020 17:04:48 +0530 Subject: [PATCH] Wekan deployed using ansible --- wekan/files/nginx.conf.j2 | 18 ++++++++++++ wekan/playbook.yml | 59 +++++++++++++++++++++++++++++++++++++++ wekan/readme.md | 46 ++++++++++++++++++++++++++++++ wekan/vars/default.yml | 12 ++++++++ 4 files changed, 135 insertions(+) create mode 100644 wekan/files/nginx.conf.j2 create mode 100755 wekan/playbook.yml create mode 100644 wekan/readme.md create mode 100644 wekan/vars/default.yml diff --git a/wekan/files/nginx.conf.j2 b/wekan/files/nginx.conf.j2 new file mode 100644 index 0000000..f389a8f --- /dev/null +++ b/wekan/files/nginx.conf.j2 @@ -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; + } +} + diff --git a/wekan/playbook.yml b/wekan/playbook.yml new file mode 100755 index 0000000..d953909 --- /dev/null +++ b/wekan/playbook.yml @@ -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 + diff --git a/wekan/readme.md b/wekan/readme.md new file mode 100644 index 0000000..f6d7ecc --- /dev/null +++ b/wekan/readme.md @@ -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). \ No newline at end of file diff --git a/wekan/vars/default.yml b/wekan/vars/default.yml new file mode 100644 index 0000000..081fcf8 --- /dev/null +++ b/wekan/vars/default.yml @@ -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://:25/?ignoreTLS=true&tls={rejectUnauthorized:false} +mail_from: Wekan Notifications