🚀 Adding Ansible configuration (not tested)

This commit is contained in:
Yohann D'ANELLO 2020-07-15 07:46:42 +02:00
parent 71f6daf0e8
commit cdc053718f
7 changed files with 89 additions and 0 deletions

14
ansible/ansible.cfg Normal file
View File

@ -0,0 +1,14 @@
[defaults]
inventory = ./hosts
timeout = 42
[privilege_escalation]
become = True
become_ask_pass = True
[ssh_connection]
pipelining = True
retries = 3
[diff]
always = yes

9
ansible/base.yml Normal file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env ansible-python
---
- hosts: beta-nk20
roles:
- apt-basic
- nk20
- python-venv
- nginx

5
ansible/hosts Normal file
View File

@ -0,0 +1,5 @@
[server]
bde-nk20-beta.adh.crans.org
[all:vars]
ansible_python_interpreter=/usr/bin/python3

View File

@ -0,0 +1,20 @@
---
- name: Install basic APT packages
apt:
update_cache: true
name:
- nginx
- python3
- python3-pip
- python3-dev
- uwsgi
- uwsgi-plugin-python3
- python3-venv
- git
- acl
- texlive-latex-extra
- texlive-fonts-extra
- texlive-lang-french
register: pkg_result
retries: 3
until: pkg_result is succedded

View File

@ -0,0 +1,19 @@
---
- name: Update Nginx conf
replace:
path: /var/www/note_kfet/nginx_note.conf.example
dest: /var/www/note_kfet/nginx_note.conf
regexp: 'note.example.org'
replace: 'bde-nk20-beta.adh.crans.org'
- name: Copy conf to Nginx
file:
path: /var/www/note_kfet/nginx_note.conf
dest: /etc/nginx/sites-enabled/nginx_note.conf
state: link
- name: Copy conf to UWSGI
file:
path: /var/www/note_kfet/uwsgi_note.ini
dest: /etc/uwsgi/apps-enabled/uwsgi_note.ini
state: link

View File

@ -0,0 +1,12 @@
---
- name: Create note_kfet dir with good permissions
file:
path: /var/www
owner: www-data
group: foo
mode: u=rw,g=rws,o=r
- name: Clone Note Kfet
git:
repo: https://gitlab.crans.org/bde/nk20.git
dest: /var/www/note_kfet

View File

@ -0,0 +1,10 @@
---
- name: Install PIP basic dependencies
pip:
requirements: /var/www/note_kfet/requirements/base.txt
virtualenv: /var/www/note_kfet/env
- name: Install PIP production dependencies
pip:
requirements: /var/www/note_kfet/requirements/production.txt
virtualenv: /var/www/note_kfet/env