Merge branch 'cas' into 'newinfra'
[cas] CRANSIBLEISED bro See merge request nounous/ansible!204certbot_on_virtu
						commit
						0614b7040f
					
				| 
						 | 
					@ -0,0 +1,23 @@
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					glob_django_cas:
 | 
				
			||||||
 | 
					  repo: 'http://gitlab.adm.crans.org/nounous/django-cas.git'
 | 
				
			||||||
 | 
					  path: '/var/local/django-cas'
 | 
				
			||||||
 | 
					  url:
 | 
				
			||||||
 | 
					    - cas.crans.org
 | 
				
			||||||
 | 
					    - cas.adm.crans.org
 | 
				
			||||||
 | 
					    - login.crans.org
 | 
				
			||||||
 | 
					    - login.adm.crans.org
 | 
				
			||||||
 | 
					    - auth.crans.org
 | 
				
			||||||
 | 
					    - auth.adm.crans.org
 | 
				
			||||||
 | 
					  ldap:
 | 
				
			||||||
 | 
					    dn: 'cn=Utilisateurs,dc=crans,dc=org'
 | 
				
			||||||
 | 
					    password: "{{ vault_cas_ldap_password }}"
 | 
				
			||||||
 | 
					    user: 'cn=cas,ou=service-users,dc=crans,dc=org'
 | 
				
			||||||
 | 
					    server: 172.16.10.157
 | 
				
			||||||
 | 
					  db:
 | 
				
			||||||
 | 
					    host: tealc.adm.crans.org
 | 
				
			||||||
 | 
					    password: "{{ vault_cas_database_password }}"
 | 
				
			||||||
 | 
					  secret_key: "{{ vault_cas_secret_key }}"
 | 
				
			||||||
 | 
					  reverse_proxy:
 | 
				
			||||||
 | 
					    - '10.231.136.0/24'
 | 
				
			||||||
 | 
					    - '2a0c:700:0:2::/64'
 | 
				
			||||||
							
								
								
									
										3
									
								
								hosts
								
								
								
								
							
							
						
						
									
										3
									
								
								hosts
								
								
								
								
							| 
						 | 
					@ -22,6 +22,9 @@ reverseproxy
 | 
				
			||||||
[dhcp:children]
 | 
					[dhcp:children]
 | 
				
			||||||
routeurs_vm
 | 
					routeurs_vm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[django_cas]
 | 
				
			||||||
 | 
					cas.adm.crans.org
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[dns_auth_master]
 | 
					[dns_auth_master]
 | 
				
			||||||
silice.adm.crans.org
 | 
					silice.adm.crans.org
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,9 +2,8 @@
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
# Django CAS server
 | 
					# Django CAS server
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- hosts: cas.adm.crans.org
 | 
					- hosts: django_cas
 | 
				
			||||||
  vars:
 | 
					  vars:
 | 
				
			||||||
    cas_secret_key: "{{ vault_cas_secret_key }}"
 | 
					    django_cas: "{{ glob_django_cas | default({}) | combine(loc_django_cas | default({})) }}"
 | 
				
			||||||
    cas_ldap_password: "{{ vault_cas_ldap_password }}"
 | 
					  roles:
 | 
				
			||||||
    cas_database_password: "{{ vault_cas_database_password }}"
 | 
					    - django-cas
 | 
				
			||||||
  roles: ["django-cas"]
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,21 @@
 | 
				
			||||||
# Django CAS
 | 
					# Django CAS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Une fois le rôle appliqué il faut aller dans `/var/local/django-cas` et faire un `./manage.py collectstatic`.
 | 
					Une fois le rôle appliqué il faut aller dans django_cas.path et faire un `./manage.py collectstatic`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Variables
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					On rassemble dans le dictionnaire django_cas toutes les variables liées au déploiement du cas. Voici une liste exhaustive des paramètres à définir :
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  - repo : Endroit d'où cloner les sources. Par défaut au crans, on utilise le dépôt : https://gitlab.crans.org/nounous/django-cas.git
 | 
				
			||||||
 | 
					  - path : Là où on va installer le logiciel.
 | 
				
			||||||
 | 
					  - url : Une liste d'url qui vont servir le cas
 | 
				
			||||||
 | 
					  - ldap : dictionnaire qui configure la discussion avec le ldap
 | 
				
			||||||
 | 
					    - dn : nom derrière lequel sont stockés les utilisateurs dans le ldap
 | 
				
			||||||
 | 
					    - password : mot de passe de connection au ldap
 | 
				
			||||||
 | 
					    - user : utilisateur avec lequel on se connecte
 | 
				
			||||||
 | 
					    - server : serveur sur lequel le ldap est situé
 | 
				
			||||||
 | 
					  - db : dictionnaire qui configure la discussion avec la base de données
 | 
				
			||||||
 | 
					    - host : l'hôte sur lequel la base de données se trouve
 | 
				
			||||||
 | 
					    - password : mot de passe d'accès
 | 
				
			||||||
 | 
					  - secret_key : le secret de django_cas
 | 
				
			||||||
 | 
					  - reverse_proxy : liste optionnelle permettant de faire tourner le cas derrière un reverse proxy tout en gardant les informations de connection originales de l'utilisateur. Il doit contenir la liste d'ip du reverse-proxy avec lequel il se connectera au CAS.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,15 +16,16 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Clone Django CAS project repository
 | 
					- name: Clone Django CAS project repository
 | 
				
			||||||
  git:
 | 
					  git:
 | 
				
			||||||
    repo: http://gitlab.adm.crans.org/nounous/django-cas.git
 | 
					    repo: '{{ django_cas.repo }}'
 | 
				
			||||||
    dest: /var/local/django-cas
 | 
					    dest: '{{ django_cas.path }}'
 | 
				
			||||||
 | 
					    force: yes
 | 
				
			||||||
    version: master
 | 
					    version: master
 | 
				
			||||||
    umask: '002'
 | 
					    umask: '002'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: Configure Django CAS
 | 
					- name: Configure Django CAS
 | 
				
			||||||
  template:
 | 
					  template:
 | 
				
			||||||
    src: cas/settings_local.py.j2
 | 
					    src: cas/settings_local.py.j2
 | 
				
			||||||
    dest: /var/local/django-cas/cas/settings_local.py
 | 
					    dest: '{{ django_cas.path }}/cas/settings_local.py'
 | 
				
			||||||
    mode: 0600
 | 
					    mode: 0600
 | 
				
			||||||
    owner: www-data
 | 
					    owner: www-data
 | 
				
			||||||
  notify: Restart uwsgi
 | 
					  notify: Restart uwsgi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,20 +1,20 @@
 | 
				
			||||||
{{ ansible_header | comment }}
 | 
					{{ ansible_header | comment }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SECRET_KEY = '{{ cas_secret_key }}'
 | 
					SECRET_KEY = '{{ django_cas.secret_key }}'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Settings for the CAS server
 | 
					# Settings for the CAS server
 | 
				
			||||||
CAS_LDAP_SERVER = "172.16.10.90"
 | 
					CAS_LDAP_SERVER = "{{ django_cas.ldap.server }}"
 | 
				
			||||||
CAS_LDAP_USER = "cn=cas,ou=service-users,dc=crans,dc=org"
 | 
					CAS_LDAP_USER = "{{ django_cas.ldap.user }}"
 | 
				
			||||||
CAS_LDAP_PASSWORD = "{{ cas_ldap_password }}"
 | 
					CAS_LDAP_PASSWORD = "{{ django_cas.ldap.password }}"
 | 
				
			||||||
CAS_LDAP_BASE_DN = "cn=Utilisateurs,dc=crans,dc=org"
 | 
					CAS_LDAP_BASE_DN = "{{ django_cas.ldap.dn }}"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Database
 | 
					# Database
 | 
				
			||||||
DATABASES = {
 | 
					DATABASES = {
 | 
				
			||||||
    'default': {
 | 
					    'default': {
 | 
				
			||||||
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
 | 
					        'ENGINE': 'django.db.backends.postgresql_psycopg2',
 | 
				
			||||||
        'NAME': 'cas',
 | 
					        'NAME': 'cas',
 | 
				
			||||||
        'HOST': 'pgsql.adm.crans.org',
 | 
					        'HOST': '{{ django_cas.db.host }}',
 | 
				
			||||||
        'USER': 'cas',
 | 
					        'USER': 'cas',
 | 
				
			||||||
        'PASSWORD': '{{ cas_database_password }}',
 | 
					        'PASSWORD': '{{ django_cas.db.password }}',
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
{{ ansible_header | comment }}
 | 
					{{ ansible_header | comment }}
 | 
				
			||||||
0   0  * * * www-data /var/local/django-cas/manage.py clearsessions
 | 
					0   0  * * * www-data {{ django_cas.path }}/manage.py clearsessions
 | 
				
			||||||
*/5 *  * * * www-data /var/local/django-cas/manage.py cas_clean_tickets
 | 
					*/5 *  * * * www-data {{ django_cas.path }}/manage.py cas_clean_tickets
 | 
				
			||||||
5   0  * * * www-data /var/local/django-cas/manage.py cas_clean_sessions
 | 
					5   0  * * * www-data {{ django_cas.path }}/manage.py cas_clean_sessions
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,7 +1,7 @@
 | 
				
			||||||
{{ ansible_header | comment }}
 | 
					{{ ansible_header | comment }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
server {
 | 
					server {
 | 
				
			||||||
     server_name cas.crans.org cas.adm.crans.org login.crans.org login.adm.crans.org auth.crans.org auth.adm.crans.org;
 | 
					     server_name {{ django_cas.url | join(' ') }};
 | 
				
			||||||
     listen 80;
 | 
					     listen 80;
 | 
				
			||||||
     listen [::]:80;
 | 
					     listen [::]:80;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,11 +11,12 @@ server {
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     location /static {
 | 
					     location /static {
 | 
				
			||||||
         alias /var/local/django-cas/cas/local_static;
 | 
					         alias {{ django_cas.path }}/cas/local_static;
 | 
				
			||||||
     }
 | 
					     }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     set_real_ip_from 10.231.136.0/24;
 | 
					{% for ip in django_cas.reverse_proxy | default([]) %}
 | 
				
			||||||
     set_real_ip_from 2a0c:700:0:2::/64;
 | 
					     set_real_ip_from {{ ip }};
 | 
				
			||||||
 | 
					{% endfor %}
 | 
				
			||||||
     real_ip_header P-Real-Ip;
 | 
					     real_ip_header P-Real-Ip;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
     location / {
 | 
					     location / {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,3 @@
 | 
				
			||||||
#!/usr/bin/tail +14
 | 
					#!/usr/bin/tail +14
 | 
				
			||||||
{{ ansible_header | comment }}
 | 
					{{ ansible_header | comment }}
 | 
				
			||||||
[0m> [38;5;82mdjango-cas-server[0m a été déployé sur cette machine. Voir [38;5;6m/var/local/django-cas/[0m.
 | 
					[0m> [38;5;82mdjango-cas-server[0m a été déployé sur cette machine. Voir [38;5;6m{{ django_cas.path }}[0m.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,8 +2,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[uwsgi]
 | 
					[uwsgi]
 | 
				
			||||||
plugin = python3
 | 
					plugin = python3
 | 
				
			||||||
chdir = /var/local/django-cas/
 | 
					chdir = {{ django_cas.path }}/
 | 
				
			||||||
wsgi-file = /var/local/django-cas/cas/wsgi.py
 | 
					wsgi-file = {{ django_cas.path }}/cas/wsgi.py
 | 
				
			||||||
max-request=50
 | 
					max-request=50
 | 
				
			||||||
cheaper = 1
 | 
					cheaper = 1
 | 
				
			||||||
cheaper-initial = 1
 | 
					cheaper-initial = 1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue