Possibilité d'associer des volumes au conteneur.

This commit is contained in:
William 2022-07-01 22:40:17 +02:00
parent 34b9d5b4d8
commit c5d6c67835
2 changed files with 17 additions and 2 deletions

View File

@ -19,6 +19,9 @@ Then create a file `vars.json` vars who contain :
"version": "master", "version": "master",
"host": "myapp.example.com", "host": "myapp.example.com",
"dockerfile": "Dockerfile", "dockerfile": "Dockerfile",
"volumes": {
"storage": "/app/storage"
},
"envvars": { "envvars": {
"APP_NAME": "Wonderful", "APP_NAME": "Wonderful",
"APP_ENV": "production" "APP_ENV": "production"
@ -29,7 +32,7 @@ Then create a file `vars.json` vars who contain :
Then run a playbook: Then run a playbook:
```bash ```bash
$ ansible-playbook -i hosts.ini playbooks/app-install.yml -e @vars.json $ ansible-playbook -i hosts.ini -e @vars.json playbooks/app-install.yml
``` ```
## Available playbooks: ## Available playbooks:

View File

@ -4,6 +4,13 @@ networks:
web: web:
external: true external: true
{% if volumes is defined %}
volumes:
{% for key,value in volumes.items() %}
{{ key }}:
{% endfor %}
{% endif %}
services: services:
app: app:
build: build:
@ -13,8 +20,13 @@ services:
- .env.pilot - .env.pilot
networks: networks:
- web - web
{% if volumes is defined %}
volumes:
{% for key,value in volumes.items() %}
- {{ key }}:{{ value }}
{% endfor %}
{% endif %}
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
- "traefik.http.routers.{{ name }}-http.rule=Host(`{{ host }}`)" - "traefik.http.routers.{{ name }}-http.rule=Host(`{{ host }}`)"
- "traefik.http.routers.{{ name }}-http.entrypoints=http" - "traefik.http.routers.{{ name }}-http.entrypoints=http"