Added caddy docker
This commit is contained in:
1 parent
8a6744a1b1
commit
5b8d77c839
7 files changed
+210
No files matched your search
@@ -0,0 +1,29 @@
|
||||
{
|
||||
auto_https off
|
||||
servers {
|
||||
trusted_proxies static private_ranges
|
||||
}
|
||||
}
|
||||
|
||||
:80 {
|
||||
handle /bar/* {
|
||||
root * /srv/bar
|
||||
try_files {path} index.html
|
||||
file_server
|
||||
}
|
||||
handle /food* {
|
||||
root * /srv/food
|
||||
try_files {path} /index.html
|
||||
file_server
|
||||
}
|
||||
handle /delivery/* {
|
||||
root * /srv/deliver
|
||||
try_files {path} index.html
|
||||
file_server
|
||||
}
|
||||
handle /qr/* {
|
||||
root * /srv/qr
|
||||
try_files {path} index.html
|
||||
file_server
|
||||
}
|
||||
}
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
---
|
||||
- hosts: all
|
||||
become: true
|
||||
vars_files:
|
||||
- vars/default.yml
|
||||
|
||||
tasks:
|
||||
- name: Pull Caddy image
|
||||
docker_image:
|
||||
name: "{{ caddy_image }}"
|
||||
source: pull
|
||||
force_source: yes
|
||||
|
||||
- name: Ensure Host Directory exist
|
||||
file:
|
||||
path: "{{ host_directory }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: Upload the Caddyfile file
|
||||
template:
|
||||
src: "files/Caddyfile.j2"
|
||||
dest: "{{ host_directory }}/Caddyfile"
|
||||
|
||||
- name: Create caddy container
|
||||
docker_container:
|
||||
name: "{{ caddy_name }}"
|
||||
image: "{{ caddy_image }}"
|
||||
state: started
|
||||
restart_policy: unless-stopped
|
||||
volumes:
|
||||
- "{{ host_directory }}/Caddyfile:/etc/caddy/Caddyfile:ro"
|
||||
- "{{ host_directory }}:/srv"
|
||||
@@ -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).
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: hopsngrains.com
|
||||
host: "menu.{{ title }}"
|
||||
caddy_name: "caddy-{{ host }}"
|
||||
caddy_image: caddy:alpine
|
||||
|
||||
host_directory: "/var/lib/{{ host }}"
|
||||
Reference in new issue
Block a user