Merge branch 'framadate' into 'master'

Framadate

See merge request nounous/ansible!24
certbot_on_virtu
pa 2020-08-05 20:04:55 +02:00
commit bda5b2152f
10 changed files with 66 additions and 33 deletions

View File

@ -0,0 +1,11 @@
glob_framadate:
contact: contact@crans.org
automatic_response: no-reply@crans.org
smtp_server: smtp.crans.org
hostname: framadate.crans.org
repo: https://framagit.org/framasoft/framadate/framadate.git
version: "e8747ffef6f64372785dd9da7c18c20112eba9bf"
admin_username: framadate
admin_password: "{{ vault_framadate_password }}"
db_password: "{{ vault_framadate_password_db }}"

View File

@ -0,0 +1,2 @@
loc_framadate:
path: /var/www/framadate

3
hosts
View File

@ -7,6 +7,9 @@
[horde] [horde]
horde-srv.adm.crans.org horde-srv.adm.crans.org
[framadate]
voyager.adm.crans.org
[dhcp] [dhcp]
dhcp.adm.crans.org dhcp.adm.crans.org
odlyd.adm.crans.org odlyd.adm.crans.org

View File

@ -0,0 +1,6 @@
#!/usr/bin/env ansible-playbook
---
# Moi j'aime pas vulcain parce qu'il sait pas jouer au jeux videos
- hosts: framadate
roles:
- framadate

View File

@ -0,0 +1,20 @@
# Framadate
Ce rôle installe un serveur framadate.
## Variables
- glob_framadate:
- contact: Adresse mail de contact de l'administrateur
- automatic_response: Adresse mail utilisée pour répondre au clients du
serveur
- smtp_server: le serveur smtp a utilisé pour envoyer les mails
- hostname: le nom de domaine du serveur
- repo: le repo git où est stocké le code source de framadate
- versoin: le commit dans lequel on se place
- admin_username: le nom d'utilisateur de l'administrateur
- admin_password: le mot de l'administrateur
- db_password: le mot de passe de la base de données
- loc_framadate:
- path: le chemin où on installe framadate

View File

@ -19,15 +19,15 @@
- name: Clone framadate project - name: Clone framadate project
git: git:
repo: "{{ framadate.repo }}" repo: "{{ glob_framadate.repo }}"
dest: "{{ framadate.path }}" dest: "{{ loc_framadate.path }}"
version: "{{ framadate.version }}" version: "{{ glob_framadate.version }}"
# Cet item là raises forcement un changed à cause du recurse: true # Cet item là raises forcement un changed à cause du recurse: true
# https://github.com/ansible/ansible/issues/32636 # https://github.com/ansible/ansible/issues/32636
- name: Set perms on framadate code - name: Set perms on framadate code
file: file:
path: "{{ framadate.path }}" path: "{{ loc_framadate.path }}"
state: directory state: directory
owner: www-data owner: www-data
group: www-data group: www-data
@ -36,7 +36,7 @@
- name: Install Framadate dependencies - name: Install Framadate dependencies
composer: composer:
command: install command: install
working_dir: "{{ framadate.path }}" working_dir: "{{ loc_framadate.path }}"
become: true become: true
become_user: www-data become_user: www-data
register: composer_result register: composer_result
@ -45,29 +45,29 @@
- name: Create log file - name: Create log file
file: file:
path: "{{ framadate.path }}/admin/stdout.log" path: "{{ loc_framadate.path }}/admin/stdout.log"
owner: www-data owner: www-data
mode: 0600 mode: 0600
- name: Configure framadate - name: Configure framadate
template: template:
src: config.php.j2 src: framadate/app/inc/config.php.j2
dest: "{{ framadate.path }}/app/inc/config.php" dest: "{{ loc_framadate.path }}/app/inc/config.php"
owner: www-data owner: www-data
group: www-data group: www-data
- name: Configure admin password - name: Configure admin password
htpasswd: htpasswd:
path: /etc/nginx/.htpasswd path: /etc/nginx/.htpasswd
name: "{{ framadate.admin_username }}" name: "{{ glob_framadate.admin_username }}"
password: "{{ framadate.admin_password }}" password: "{{ glob_framadate.admin_password }}"
owner: root owner: root
group: www-data group: www-data
mode: 0640 mode: 0640
- name: Configure nginx site - name: Configure nginx site
template: template:
src: nginx-site.j2 src: nginx/sites-available/framadate.j2
dest: /etc/nginx/sites-available/framadate dest: /etc/nginx/sites-available/framadate
notify: restart nginx notify: restart nginx
@ -88,7 +88,7 @@
mysql_user: mysql_user:
login_unix_socket: /var/run/mysqld/mysqld.sock login_unix_socket: /var/run/mysqld/mysqld.sock
name: framadate name: framadate
password: "{{ framadate.db_password }}" password: "{{ glob_framadate.db_password }}"
priv: 'framadate.*:ALL' priv: 'framadate.*:ALL'
state: present state: present

View File

@ -25,16 +25,16 @@
// Fully qualified domain name of your webserver. // Fully qualified domain name of your webserver.
// If this is unset or empty, the servername is determined automatically. // If this is unset or empty, the servername is determined automatically.
// You *have to set this* if you are running Framadate behind a reverse proxy. // You *have to set this* if you are running Framadate behind a reverse proxy.
// const APP_URL = 'framadate.crans.org'; // const APP_URL = '{{ glob_framadate.hostname }}';
// Application name // Application name
const NOMAPPLICATION = 'Framadate'; const NOMAPPLICATION = 'Framadate';
// Database administrator email // Database administrator email
const ADRESSEMAILADMIN = 'contact@crans.org'; const ADRESSEMAILADMIN = '{{ glob_framadate.contact }}';
// Email for automatic responses (you should set it to "no-reply") // Email for automatic responses (you should set it to "no-reply")
const ADRESSEMAILREPONSEAUTO = 'no-reply@crans.org'; const ADRESSEMAILREPONSEAUTO = '{{ glob_framadate.automatic_response }}';
// Database server name, leave empty to use a socket // Database server name, leave empty to use a socket
const DB_CONNECTION_STRING = 'mysql:host=localhost;dbname=framadate;port=3306'; const DB_CONNECTION_STRING = 'mysql:host=localhost;dbname=framadate;port=3306';
@ -43,7 +43,7 @@ const DB_CONNECTION_STRING = 'mysql:host=localhost;dbname=framadate;port=3306';
const DB_USER= 'framadate'; const DB_USER= 'framadate';
// Database password // Database password
const DB_PASSWORD = '{{ framadate.db_password }}'; const DB_PASSWORD = '{{ glob_framadate.db_password }}';
// Table name prefix // Table name prefix
const TABLENAME_PREFIX = 'fd_'; const TABLENAME_PREFIX = 'fd_';
@ -92,7 +92,7 @@ $config = [
/* general config */ /* general config */
'use_smtp' => true, // use email for polls creation/modification/responses notification 'use_smtp' => true, // use email for polls creation/modification/responses notification
'smtp_options' => [ 'smtp_options' => [
'host' => 'smtp.crans.org', // SMTP server (you could add many servers (main and backup for example) : use ";" like separator 'host' => '{{ glob_framadate.smtp_server }}', // SMTP server (you could add many servers (main and backup for example) : use ";" like separator
'auth' => false, // Enable SMTP authentication 'auth' => false, // Enable SMTP authentication
'username' => '', // SMTP username 'username' => '', // SMTP username
'password' => '', // SMTP password 'password' => '', // SMTP password

View File

@ -4,12 +4,12 @@ server {
listen 80; listen 80;
listen [::]:80; listen [::]:80;
server_name framadate.crans.org; server_name {{ glob_framadate.hostname }};
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; object-src 'none'; style-src 'self' 'unsafe-inline'; font-src 'self'; img-src 'self'"; add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; object-src 'none'; style-src 'self' 'unsafe-inline'; font-src 'self'; img-src 'self'";
add_header Referrer-Policy "strict-origin"; add_header Referrer-Policy "strict-origin";
root {{ framadate.path }}; root {{ loc_framadate.path }};
index index.php; index index.php;

View File

@ -1,3 +1,3 @@
#!/usr/bin/tail +14 #!/usr/bin/tail +14
{{ ansible_header | comment }} {{ ansible_header | comment }}
> Framadate a été déployé sur cette machine. Voir {{ framadate.path }}. > Framadate a été déployé sur cette machine. Voir {{ loc_framadate.path }}.

View File

@ -4,19 +4,6 @@
- hosts: soyouz.adm.crans.org - hosts: soyouz.adm.crans.org
roles: [] # TODO roles: [] # TODO
# Deploy FramaDate
- hosts: voyager.adm.crans.org
vars:
framadate:
repo: https://framagit.org/framasoft/framadate/framadate.git
version: "e8747ffef6f64372785dd9da7c18c20112eba9bf"
path: /var/www/framadate
admin_username: framadate
admin_password: "{{ vault_framadate_password }}"
db_password: "{{ vault_framadate_password_db }}"
roles:
- framadate
- hosts: cas-srv.adm.crans.org - hosts: cas-srv.adm.crans.org
roles: ["django-cas"] roles: ["django-cas"]
@ -26,3 +13,7 @@
- hosts: ethercalc-srv.adm.crans.org - hosts: ethercalc-srv.adm.crans.org
roles: ["ethercalc"] roles: ["ethercalc"]
- import_playbook: plays/horde.yml
- import_playbook: plays/framadate.yml