├── .github └── workflows │ └── lint.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .yamllint ├── LICENSE ├── Makefile ├── README.md ├── README.yaml ├── defaults └── main.yml ├── handlers └── main.yml ├── meta └── main.yml ├── tasks ├── configure.yml ├── install.yml ├── main.yml └── users.yml └── templates ├── config └── pritunl.conf ├── pritunl └── pritunl.service /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Lint 3 | 'on': 4 | pull_request: 5 | push: 6 | branches: 7 | - master 8 | 9 | jobs: 10 | 11 | test: 12 | name: Lint 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - name: Check out the codebase. 17 | uses: actions/checkout@v2 18 | 19 | - name: Set up Python 3.7. 20 | uses: actions/setup-python@v2 21 | with: 22 | python-version: '3.x' 23 | 24 | - name: Install test dependencies. 25 | run: pip3 install yamllint ansible-lint 26 | 27 | - name: Run yamllint. 28 | run: yamllint . 29 | 30 | 31 | - name: 'Slack Notification' 32 | uses: clouddrove/action-slack@v2 33 | with: 34 | status: ${{ job.status }} 35 | fields: repo,author 36 | author_name: 'Clouddrove' 37 | env: 38 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 39 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} 40 | if: always() 41 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # ignored files 2 | .idea 3 | *.iml 4 | *.zip 5 | molecule 6 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | repos: 3 | 4 | - repo: https://github.com/pre-commit/pre-commit-hooks.git 5 | rev: v2.2.3 6 | hooks: 7 | - id: end-of-file-fixer 8 | - id: trailing-whitespace 9 | - id: mixed-line-ending 10 | - id: check-byte-order-marker 11 | - id: check-executables-have-shebangs 12 | - id: check-merge-conflict 13 | - id: debug-statements 14 | - id: check-yaml 15 | - id: check-added-large-files 16 | 17 | - repo: https://github.com/ansible/ansible-lint.git 18 | rev: v4.1.0 19 | hooks: 20 | - id: ansible-lint 21 | files: \.(yaml|yml)$ 22 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | --- 2 | extends: default 3 | 4 | rules: 5 | line-length: 6 | max: 120 7 | level: warning 8 | truthy: 9 | allowed-values: ['true', 'false', 'yes', 'no'] 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Cloud Drove 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export GENIE_PATH ?= $(shell 'pwd')/../../../genie 2 | 3 | include $(GENIE_PATH)/Makefile 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
11 | This ansible role is used to install Pritunl and Mongodb with docker on server. 12 |
13 | 14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
We are The Cloud Experts!
135 |We ❤️ Open Source and you can check out our other modules to get help with your new Cloud ideas.
137 | 138 | [website]: https://clouddrove.com 139 | [github]: https://github.com/clouddrove 140 | [linkedin]: https://cpco.io/linkedin 141 | [twitter]: https://twitter.com/clouddrove/ 142 | [email]: https://clouddrove.com/contact-us.html 143 | [terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language= 144 | -------------------------------------------------------------------------------- /README.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # 3 | # This is the canonical configuration for the `README.md` 4 | # Run `make readme` to rebuild the `README.md` 5 | # 6 | 7 | # Name of this project 8 | name: Ansible Role Docker Pritunl 9 | 10 | # License of this project 11 | license: "MIT" 12 | 13 | # Canonical GitHub repo 14 | github_repo: clouddrove/ansible-role-docker-pritunl 15 | 16 | # Badges to display 17 | badges: 18 | - name: "Ansible" 19 | image: "https://img.shields.io/badge/Ansible-2.8-green?style=flat&logo=ansible" 20 | url: "https://www.ansible.com" 21 | - name: "Licence" 22 | image: "https://img.shields.io/badge/License-MIT-blue.svg" 23 | url: "LICENSE.md" 24 | - name: "Distribution" 25 | image: "https://img.shields.io/badge/ubuntu-16.x-orange?style=flat&logo=ubuntu" 26 | url: "https://ubuntu.com/" 27 | - name: "Distribution" 28 | image: "https://img.shields.io/badge/ubuntu-18.x-orange?style=flat&logo=ubuntu" 29 | url: "https://ubuntu.com/" 30 | - name: "Distribution" 31 | image: "https://img.shields.io/badge/centos-7.x-orange" 32 | url: "https://www.centos.org/" 33 | 34 | # Prerequesties to display 35 | # yamllint disable 36 | prerequesties: 37 | - name: "Ansible2.8" 38 | url: "https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html" 39 | - name: "Python" 40 | url: "https://www.python.org/downloads" 41 | - name: "Docker" 42 | url: "https://docs.docker.com/install/linux/docker-ce/ubuntu" 43 | # yamllint enable 44 | # What Includes to display 45 | what_includes: 46 | - name: "pritunl" 47 | - name: "mongodb" 48 | 49 | # description of this project 50 | description: |- 51 | This ansible role is used to install Pritunl and Mongodb with docker on server. 52 | 53 | # How to use this project 54 | usage: |- 55 | ```yaml 56 | - hosts: localhost 57 | remote_user: root 58 | become: true 59 | roles: 60 | - clouddrove.ansible_role_docker_pritunl 61 | ``` 62 | 63 | ## For default password 64 | ```console 65 | $ sudo docker exec -it pritunl pritunl default-password 66 | ``` 67 | 68 | # Variables use in the project 69 | variables: |- 70 | ```yaml 71 | pritunl_version: "latest" 72 | pritunl_path: "/opt/pritunl" 73 | pritunl_log: "/var/log/pritunl.log" 74 | pritunl_user: pritunl 75 | pritunl_group: pritunl 76 | mongo_path: "/opt/pritunl/mongo" 77 | mongo_user: mongo 78 | mongo_group: mongo 79 | ``` 80 | 81 | # How to install project 82 | installation: |- 83 | ```console 84 | $ ansible-galaxy install clouddrove.ansible_role_docker_pritunl 85 | ``` 86 | -------------------------------------------------------------------------------- /defaults/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | # Pritunl variable 4 | pritunl_version: "latest" 5 | 6 | # Pritunl settings 7 | pritunl_path: "/opt/pritunl" 8 | pritunl_log: "/var/log/pritunl.log" 9 | pritunl_user: pritunl 10 | pritunl_group: pritunl 11 | 12 | # Mongo settings 13 | mongo_path: "/opt/pritunl/mongo" 14 | mongo_user: mongo 15 | mongo_group: mongo 16 | -------------------------------------------------------------------------------- /handlers/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: restart pritunl 4 | service: 5 | name: pritunl 6 | state: restarted 7 | enabled: true 8 | 9 | - name: reload pritunl 10 | service: 11 | name: pritunl 12 | state: reloaded 13 | enabled: true 14 | 15 | - name: start pritunl 16 | service: 17 | name: pritunl 18 | state: started 19 | enabled: true 20 | -------------------------------------------------------------------------------- /meta/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | dependencies: [] 4 | 5 | galaxy_info: 6 | author: Anmol Nagpal 7 | description: This ansible role is used to install Pritunl and Mongodb with docker on server. 8 | company: "CloudDrove Inc." 9 | license: "license (BSD, MIT)" 10 | min_ansible_version: 2.4 11 | platforms: 12 | - name: Debian 13 | versions: 14 | - jessie 15 | - stretch 16 | - name: Ubuntu 17 | versions: 18 | - trusty 19 | - xenial 20 | - bionic 21 | galaxy_tags: 22 | - pritunl 23 | - mongodb 24 | - docker 25 | - centos 26 | - ubuntu 27 | -------------------------------------------------------------------------------- /tasks/configure.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: create pritunl dirs 4 | file: 5 | path: "{{item|safe|trim}}" 6 | state: directory 7 | owner: "{{pritunl_user}}" 8 | group: "{{pritunl_group}}" 9 | mode: 0755 10 | recurse: true 11 | with_items: 12 | - "{{pritunl_path}}" 13 | 14 | - name: create pritunl mongo dirs 15 | file: 16 | path: "{{item|safe|trim}}" 17 | state: directory 18 | owner: "{{mongo_user}}" 19 | group: "{{mongo_group}}" 20 | mode: 0755 21 | recurse: true 22 | with_items: 23 | - "{{mongo_path}}" 24 | 25 | - name: transfer pritunl.conf 26 | template: 27 | dest: "{{pritunl_path}}/pritunl.conf" 28 | src: "{{item}}" 29 | with_items: 30 | - config/pritunl.conf 31 | 32 | - name: create pritunl log 33 | shell: touch {{pritunl_log}} 34 | -------------------------------------------------------------------------------- /tasks/install.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: copy pritunl script 4 | template: 5 | src: "pritunl" 6 | dest: /usr/local/bin/pritunl 7 | mode: 0755 8 | owner: root 9 | group: root 10 | 11 | - name: copy pritunl service 12 | template: 13 | src: "pritunl.service" 14 | dest: /etc/systemd/system/pritunl.service 15 | mode: 0644 16 | owner: root 17 | group: root 18 | notify: 19 | - restart pritunl 20 | 21 | - name: ensure pritunl service is restarted 22 | service: 23 | name: pritunl 24 | state: restarted 25 | enabled: true 26 | changed_when: false 27 | 28 | - name: wait for pritunl to become ready 29 | wait_for: 30 | host: "0.0.0.0" 31 | port: "443" 32 | state: started 33 | delay: 5 34 | connect_timeout: 15 35 | timeout: 500 36 | -------------------------------------------------------------------------------- /tasks/main.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - import_tasks: users.yml 4 | - import_tasks: configure.yml 5 | - import_tasks: install.yml 6 | -------------------------------------------------------------------------------- /tasks/users.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | - name: setup group 4 | group: 5 | name: "{{pritunl_group}}" 6 | system: false 7 | 8 | - name: setup user 9 | user: 10 | name: "{{pritunl_user}}" 11 | system: false 12 | group: "{{pritunl_group}}" 13 | 14 | - name: setup group 15 | group: 16 | name: "{{mongo_group}}" 17 | system: false 18 | 19 | - name: setup user 20 | user: 21 | name: "{{mongo_user}}" 22 | system: false 23 | group: "{{mongo_group}}" 24 | -------------------------------------------------------------------------------- /templates/config/pritunl.conf: -------------------------------------------------------------------------------- 1 | # {{ ansible_managed }} 2 | { 3 | "mongodb_uri": "mongodb://localhost:27017/pritunl", 4 | "server_key_path": "/var/lib/pritunl/pritunl.key", 5 | "log_path": "{{ pritunl_log }}", 6 | "static_cache": true, 7 | "server_cert_path": "/var/lib/pritunl/pritunl.crt", 8 | "temp_path": "/tmp/pritunl_%r", 9 | "bind_addr": "0.0.0.0", 10 | "debug": false, 11 | "www_path": "/usr/share/pritunl/www", 12 | "local_address_interface": "auto" 13 | } 14 | -------------------------------------------------------------------------------- /templates/pritunl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eux -o pipefail 4 | 5 | # pull the image before so we dont first remove the container and then pull 6 | docker pull clouddrove/pritunl:{{ pritunl_version }} 7 | 8 | docker rm -f -v pritunl || : 9 | 10 | docker run --name pritunl --privileged \ 11 | -v "{{ pritunl_path }}":/var/lib/pritunl \ 12 | -v "{{ mongo_path }}":/var/lib/mongodb \ 13 | -v "{{ pritunl_path }}/pritunl.conf":/etc/pritunl.conf \ 14 | -v "{{ pritunl_log }}":{{ pritunl_log }} \ 15 | -v pritunl-conf:/etc \ 16 | -p 1194:1194/udp \ 17 | -p 1194:1194/tcp \ 18 | -p 80:80/tcp \ 19 | -p 443:443/tcp \ 20 | clouddrove/pritunl:{{ pritunl_version }} 21 | -------------------------------------------------------------------------------- /templates/pritunl.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Pritunl Server 3 | After=docker.service 4 | Requires=docker.service 5 | 6 | [Service] 7 | TimeoutStartSec=0 8 | Restart=always 9 | ExecStart=/usr/local/bin/pritunl 10 | ExecStop=-/usr/bin/docker rm -f -v pritunl 11 | 12 | [Install] 13 | WantedBy=multi-user.target 14 | --------------------------------------------------------------------------------