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",
"host": "myapp.example.com",
"dockerfile": "Dockerfile",
"volumes": {
"storage": "/app/storage"
},
"envvars": {
"APP_NAME": "Wonderful",
"APP_ENV": "production"
@ -29,7 +32,7 @@ Then create a file `vars.json` vars who contain :
Then run a playbook:
```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:

View File

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