From fc8a7795e66f8a2b7f451044ccefe5fbb62ad16d Mon Sep 17 00:00:00 2001 From: tanshu Date: Mon, 20 Apr 2020 18:13:06 +0530 Subject: [PATCH] Added: Readme Added: Restart policy --- README.md | 74 +++++++++++++++++++++++++++++++++++ bitwarden/playbook.yml | 1 + gitea/playbook-pg.yml | 1 + gitea/playbook.yml | 3 +- nextcloud/files/nginx.conf.j2 | 3 ++ nextcloud/playbook.yml | 6 ++- nextcloud/vars/default.yml | 2 +- postgres/playbook.yml | 1 + redis/playbook.yml | 1 + trilium/playbook.yml | 1 + 10 files changed, 89 insertions(+), 4 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..31d3107 --- /dev/null +++ b/README.md @@ -0,0 +1,74 @@ +# DO Community - Ansible Playbooks + +A collection of minimalist Ansible playbooks for automating server setups, based on DigitalOcean's Community guides. + +- [Initial Server Setup for Ubuntu 18.04](https://github.com/do-community/ansible-playbooks/tree/master/setup_ubuntu1804) * +- [Apache on Ubuntu 18.04](https://github.com/do-community/ansible-playbooks/tree/master/apache_ubuntu1804) +- [Postgres on Ubuntu 19.10](https://git.tanshu.com/tanshu/playbooks/src/branch/master/postgres) +- [Redis on Ubuntu 19.10](https://git.tanshu.com/tanshu/playbooks/src/branch/master/redis) +- [Bitwarden Ubuntu 19.10](https://git.tanshu.com/tanshu/playbooks/src/branch/master/bitwarden) +- [Gitea on Ubuntu 19.10](https://git.tanshu.com/tanshu/playbooks/src/branch/master/gitea) + +_\*the Initial Server Setup should be your starting point for fresh servers._ + +## Playbook Structure + +The playbooks contained in this repository were created for educational purposes, and should serve as a base for you to create your own playbooks and roles. + +Although we opt to not use roles, our playbooks follow a distinctive structure to facilitate reuse while keeping them mostly self-contained and straightforward. + +For instance, this is how the `lemp` playbook is structured: + +``` +lemp_ubuntu1804 +├── files +│   ├── info.php.j2 +│   └── nginx.conf.j2 +├── vars +│   └── default.yml +├── playbook.yml +└── readme.md +``` + + +- `files/`: directory containing templates and other files required by the playbook. +- `vars/`: directory to save variable files. A `default.yml` var file is included by default. +- `playbook.yml`: the playbook file. +- `readme.md`: instructions and links related to this playbook. + +## Getting Started + +To set up your Ansible environment, please follow our guide on [How to Install and Configure Ansible on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-ansible-on-ubuntu-18-04). + +### Connection Test + +From your local machine or Ansible control node, run: + +```command +ansible all -m ping -u remote_user +``` + +If you're able to get a "pong" reply back from your node(s), your setup works as expected and you'll be able to run both ad-hoc commands and playbooks on your nodes, using Ansible. + +## Guides + +The following guides cover how to use the playbooks you'll find in this repository. + +### Initial Server Setup + +- [Initial Server Setup for Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-ansible-on-ubuntu-18-04) + +Once you have executed the initial server setup, you can choose from any of the available server setup playbooks: + +### Web Servers +- [Apache on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-apache-on-ubuntu-18-04) +- [LEMP (Linux, Nginx, MySQL, PHP) on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-lemp-on-ubuntu-18-04) +- [LAMP (Linux, Apache, MySQL, PHP) on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-lamp-on-ubuntu-18-04) + +### Applications & CMSs + +- [WordPress with LAMP on Ubuntu 18.04](https://www.digitalocean.com/community/tutorials/how-to-use-ansible-to-install-and-set-up-wordpress-with-lamp-on-ubuntu-18-04) + +### Containers & K8s +- [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) + diff --git a/bitwarden/playbook.yml b/bitwarden/playbook.yml index 5f19896..da8be16 100755 --- a/bitwarden/playbook.yml +++ b/bitwarden/playbook.yml @@ -18,6 +18,7 @@ name: "{{ container_name }}" image: "{{ container_image }}" state: started + restart_policy: "unless-stopped" env: DATABASE_URL: "{{ db_url }}" links: "postgres:db" diff --git a/gitea/playbook-pg.yml b/gitea/playbook-pg.yml index 25ea050..0d061f3 100755 --- a/gitea/playbook-pg.yml +++ b/gitea/playbook-pg.yml @@ -29,6 +29,7 @@ name: "{{ container_name }}" image: "{{ container_image }}" state: started + restart_policy: "unless-stopped" env: USER_UID: "{{ getent_passwd[user][1] }}" USER_GID: "{{ getent_passwd[user][2] }}" diff --git a/gitea/playbook.yml b/gitea/playbook.yml index 3e07fb6..6acfccd 100755 --- a/gitea/playbook.yml +++ b/gitea/playbook.yml @@ -12,7 +12,7 @@ user: name: "{{ user }}" comment: Git user - create_home: no + create_home: yes - name: Pull Gitea image docker_image: @@ -29,6 +29,7 @@ name: "{{ container_name }}" image: "{{ container_image }}" state: started + restart_policy: "unless-stopped" env: USER_UID: "{{ getent_passwd[user][1] }}" USER_GID: "{{ getent_passwd[user][2] }}" diff --git a/nextcloud/files/nginx.conf.j2 b/nextcloud/files/nginx.conf.j2 index ee9074e..bf73ab8 100644 --- a/nextcloud/files/nginx.conf.j2 +++ b/nextcloud/files/nginx.conf.j2 @@ -3,6 +3,9 @@ server { listen 80; server_name {{ http_host }}; + # set max upload size + client_max_body_size 10G; + location / { proxy_set_header Host $host:$server_port; diff --git a/nextcloud/playbook.yml b/nextcloud/playbook.yml index a5a8cd8..6f75127 100755 --- a/nextcloud/playbook.yml +++ b/nextcloud/playbook.yml @@ -31,15 +31,16 @@ name: "{{ container_name }}" image: "{{ container_image }}" state: started + restart_policy: "unless-stopped" env: POSTGRES_DB: "{{ db_name }}" POSTGRES_USER: "{{ db_user }}" POSTGRES_PASSWORD: "{{ db_pass }}" POSTGRES_HOST: "{{ db_host }}" - REDIS_HOST: "redis" +# REDIS_HOST: "redis" links: - "postgres:db" - - "redis:redis" +# - "redis:redis" published_ports: - "9000:9000" volumes: @@ -50,6 +51,7 @@ name: cloud-web image: nextcloud-web state: started + restart_policy: "unless-stopped" links: - "cloud:app" published_ports: diff --git a/nextcloud/vars/default.yml b/nextcloud/vars/default.yml index 6051efa..f85a6ec 100644 --- a/nextcloud/vars/default.yml +++ b/nextcloud/vars/default.yml @@ -3,7 +3,7 @@ http_host: "cloud.hopsngrains.com" http_conf: "cloud.hopsngrains.com.conf" container_name: cloud -container_image: nextcloud:fpm-alpine +container_image: nextcloud:fpm db_name: "nextcloud" db_user: "postgres" diff --git a/postgres/playbook.yml b/postgres/playbook.yml index d5e4c75..0b9bac5 100755 --- a/postgres/playbook.yml +++ b/postgres/playbook.yml @@ -19,6 +19,7 @@ name: "{{ postgres_name }}" image: "{{ postgres_image }}" state: started + restart_policy: "unless-stopped" env: POSTGRESQL_USER: "{{ pg_user }}" POSTGRESQL_PASSWORD: "{{ pg_password }}" diff --git a/redis/playbook.yml b/redis/playbook.yml index 1b421ba..b6d83e8 100755 --- a/redis/playbook.yml +++ b/redis/playbook.yml @@ -15,4 +15,5 @@ name: "{{ container_name }}" image: "{{ container_image }}" state: started + restart_policy: "unless-stopped" diff --git a/trilium/playbook.yml b/trilium/playbook.yml index f86c164..69ae46a 100755 --- a/trilium/playbook.yml +++ b/trilium/playbook.yml @@ -19,6 +19,7 @@ name: "{{ container_name }}" image: "{{ container_image }}" state: started + restart_policy: "unless-stopped" published_ports: - 127.0.0.1:8888:8080 volumes: