Merge remote-tracking branch 'origin/master' into master

This commit is contained in:
Bertrand Benjamin 2020-09-25 13:49:20 +02:00
commit 211b7d5725
6 changed files with 68 additions and 18 deletions

View File

@ -1 +1 @@
<h1> Serveur pédagogique pour {{ name }} </h1> <h1> Serveur pédagogique pour {{ item.name }} </h1>

2
hosts Normal file
View File

@ -0,0 +1,2 @@
[all]
stex.ovh ansible_port=25022 ansible_user=root

View File

@ -1,6 +1,6 @@
--- ---
- hosts: 127.0.0.1 - hosts: all
connection: local #ask_pass: true
become: true become: true
vars_files: vars_files:
- vars/default.yml - vars/default.yml

View File

@ -1 +1,42 @@
--- ---
- name: add users
user:
name: "{{ item.name }}"
create_home: true
password: "{{ lookup('password', './pass/' + item.name + '_pass length=10 chars=ascii_letters') | password_hash('sha512') }}"
update_password: on_create
with_items: "{{ users }}"
register: returned
- name: create public_html
file:
path: "/home/{{ item.name}}/public_html/"
owner: "{{ item.name }}"
group: www-data
state: directory
with_items: "{{ users }}"
- name: Sets Up Index page
template:
src: "files/index.html.j2"
dest: "/home/{{ item.name }}/public_html/index.html"
mode: 774
with_items: "{{ users }}"
- name: create database
mysql_db:
db: "{{ item.name }}"
state: present
login_user: root
login_password: "{{ mysql_root_password }}"
with_items: "{{ users }}"
- name: create db user
mysql_user:
user: "{{ item.name }}"
password: "{{ lookup('password', './pass/' + item.name + '_sql length=10 chars=ascii_letters') | password_hash('sha512') }}"
priv: "{{ item.name + '.*:ALL,GRANT' }}"
login_user: root
login_password: "{{ mysql_root_password }}"
state: present
with_items: "{{ users }}"

View File

@ -66,8 +66,9 @@
- name: Sets Up Index page - name: Sets Up Index page
template: template:
src: "files/index.html.j2" src: "files/index.html.j2"
dest: "/var/www/{{ http_host }}/info.php" dest: "/var/www/{{ http_host }}/index.html"
vars: vars:
item:
name: "la SNT" name: "la SNT"
- name: Enable userdir - name: Enable userdir

View File

@ -1,14 +1,20 @@
--- ---
tribes: #tribes:
- "2GT1G1" # - "2GT1G1"
- "2GT1G2" # - "2GT1G2"
- "2GT2G1" # - "2GT2G1"
- "2GT2G2" # - "2GT2G2"
- "2GT3G1" # - "2GT3G1"
- "2GT3G2" # - "2GT3G2"
- "2GT4G1" # - "2GT4G1"
- "2GT4G2" # - "2GT4G2"
- "2GT5G1" # - "2GT5G1"
- "2GT5G2" # - "2GT5G2"
- "2GT6G1" # - "2GT6G1"
- "2GT6G2" # - "2GT6G2"
#profs:
# - "proftest"
#users: tribes + profs
users:
- name: test1
- name: test2