Premier commit
This commit is contained in:
commit
807eef682f
10 changed files with 132 additions and 0 deletions
48
README.md
Normal file
48
README.md
Normal file
|
@ -0,0 +1,48 @@
|
|||
# Role : docker_grav
|
||||
|
||||
|
||||
## Services fournis
|
||||
|
||||
- main.yml : Installation d'une instance grav sur un serveur docker_host
|
||||
- configure_reverse_proxy.yml : Configuration d'un reverse proxy préalablement installé par le role reverse_proxy
|
||||
|
||||
Le reverse proxy est configuré de sorte que la section /admin de grav soit protégée et accessible uniquement à des utilisateurs ayant un compte LDAP validé par le reverse proxy.
|
||||
|
||||
## Variables
|
||||
|
||||
Fournir les variables suivantes. Par exemple :
|
||||
|
||||
```yaml
|
||||
docker_grav_fqdn: monsite.libretic.fr
|
||||
docker_grav_data_dir: /data1
|
||||
docker_grav_service_id: monsite
|
||||
docker_grav_ldap_admin_users: user1 user2
|
||||
docker_grav_image_version: 1.7.31
|
||||
docker_grav_rp_cert: LE
|
||||
docker_grav_rp_docker_host: machine.domaine.local
|
||||
docker_grav_rp_access_policy: OpenAccessPolicy
|
||||
docker_grav_rp_indexing: BlockCrawlerIndexing
|
||||
docker_grav_rp_waf: On
|
||||
```
|
||||
|
||||
| Option | Valeur par défaut | Description |
|
||||
|------------------------------|-------------------|-------------------------------------------------------------------------------------------|
|
||||
| docker_grav_fqdn | | Nom de domaine, ou liste de noms de domaines, pour lequel le service grav répond |
|
||||
| docker_grav_data_dir | | L'emplacement dans lequel se trouvent les volumes de donnees docker pour le service |
|
||||
| docker_grav_service_id | | Le nom de service souhaité : conditionne le nommage des volumes et le routage par traefik |
|
||||
| docker_grav_ldap_admin_users | | Utilisateurs LDAP autorisés à passer le reverse proxy pour la section /admin de grav |
|
||||
| docker_grav_image_version | | Version de grav et de l'image docker |
|
||||
| docker_grav_rp_docker_host | | pour configure_reverse_proxy.yml: fqdn de la machine contenant le conteneur docker |
|
||||
| docker_grav_rp_cert | LE | Type de certificat pour le reverse proxy (LE = letsencrypt) |
|
||||
| docker_grav_rp_access_policy | | Modèle d'autorisation d'accès du reverse proxy |
|
||||
| docker_grav_rp_indexing | | Stratégie du reverse proxy vis à vis des robots |
|
||||
| docker_grav_rp_waf | | Activation websecurity du reverse proxy |
|
||||
| | | |
|
||||
|
||||
|
||||
|
||||
## Poursuite de l'installation dans grav
|
||||
|
||||
Après le premier lancement :
|
||||
- créer le compte administrateur interne de grav depuis la page d'administration
|
||||
|
1
defaults/main.yml
Normal file
1
defaults/main.yml
Normal file
|
@ -0,0 +1 @@
|
|||
docker_grav_rp_cert: LE
|
10
handlers/main.yml
Normal file
10
handlers/main.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
- name: docker-compose-up
|
||||
shell: |
|
||||
docker-compose up -d
|
||||
args:
|
||||
chdir: /opt/{{ docker_grav_service_id }}/
|
||||
|
||||
- name: reverse-proxy-reload
|
||||
service:
|
||||
name: apache2
|
||||
state: reloaded
|
8
tasks/configure_reverse_proxy.yml
Normal file
8
tasks/configure_reverse_proxy.yml
Normal file
|
@ -0,0 +1,8 @@
|
|||
- name: prepare reverse_proxy
|
||||
include_tasks: configure_reverse_proxy_fqdn.yml
|
||||
loop: "{{ docker_grav_fqdn }}"
|
||||
loop_control:
|
||||
loop_var: _fqdn
|
||||
|
||||
|
||||
|
11
tasks/configure_reverse_proxy_fqdn.yml
Normal file
11
tasks/configure_reverse_proxy_fqdn.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
- name: prepare reverse_proxy_fqdn
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: /etc/apache2/vhosts.d/{{ _fqdn }}/
|
||||
with_items:
|
||||
- 0_vhost.conf
|
||||
- 1_vhost_additional.conf
|
||||
- 2_mds_exclusion.conf
|
||||
notify: reverse-proxy-reload
|
||||
|
||||
|
14
tasks/main.yml
Normal file
14
tasks/main.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
- name: docker directory
|
||||
file:
|
||||
path: /opt/{{ docker_grav_service_id }}/
|
||||
state: directory
|
||||
|
||||
- name: prepare docker-compose.yml
|
||||
template:
|
||||
src: "{{ item }}"
|
||||
dest: /opt/{{ docker_grav_service_id }}/
|
||||
with_items:
|
||||
- docker-compose.yml
|
||||
notify: docker-compose-up
|
||||
|
||||
|
2
templates/0_vhost.conf
Normal file
2
templates/0_vhost.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
# {{ ansible_managed }}
|
||||
Use vhost_HTTPS_Generic {{ _fqdn }} {{ docker_grav_rp_cert }} http {{ docker_grav_rp_docker_host }} info {{ docker_grav_rp_access_policy }} {{ docker_grav_rp_indexing }} {{ docker_grav_rp_waf }}
|
11
templates/1_vhost_additional.conf
Normal file
11
templates/1_vhost_additional.conf
Normal file
|
@ -0,0 +1,11 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
Header set Content-Security-Policy "default-src 'self'; img-src 'self'; style-src 'self'; script-src 'self'; object-src 'none'"
|
||||
|
||||
ProxyErrorOverride off
|
||||
RequestHeader unset Authorization
|
||||
|
||||
<Location /admin>
|
||||
Use LDAPUserAccessPolicy
|
||||
Require ldap-user {{ docker_grav_ldap_admin_users | join(' ') }}
|
||||
</Location>
|
1
templates/2_mds_exclusion.conf
Normal file
1
templates/2_mds_exclusion.conf
Normal file
|
@ -0,0 +1 @@
|
|||
# {{ ansible_managed }}
|
26
templates/docker-compose.yml
Normal file
26
templates/docker-compose.yml
Normal file
|
@ -0,0 +1,26 @@
|
|||
# {{ ansible_managed }}
|
||||
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
grav:
|
||||
image: lscr.io/linuxserver/grav:{{ docker_grav_image_version }}
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=Europe/Paris
|
||||
volumes:
|
||||
- /data1/{{ docker_grav_service_id }}/config:/config
|
||||
restart: always
|
||||
labels:
|
||||
- "traefik.enable=true"
|
||||
- "traefik.docker.network=traefik"
|
||||
- "traefik.http.routers.{{ docker_grav_service_id }}.entrypoints=web"
|
||||
- "traefik.http.routers.{{ docker_grav_service_id }}.rule=Host(`{{ docker_grav_fqdn | join('`) || Host(`') }}`)"
|
||||
- "traefik.http.services.{{ docker_grav_service_id }}.loadbalancer.server.port=80"
|
||||
networks:
|
||||
- traefik
|
||||
|
||||
networks:
|
||||
traefik:
|
||||
external: true
|
Loading…
Reference in a new issue