maj ansible install + divers

This commit is contained in:
icon 2022-09-01 10:11:45 +04:00
parent f471d42486
commit 23524b9491
16 changed files with 445 additions and 174 deletions

9
auto_startx_bashrc Executable file
View File

@ -0,0 +1,9 @@
#! /bin/bash
if grep "#modif bashrc = ok" /home/sysop/.bashrc > /dev/null
then
echo 'bashrc déjà modifié pour auto startx !'
else
sudo echo 'export TYPE_SERVEUR_NFC=VMA405' >> /home/sysop/.bashrc
sudo echo '#modif bashrc = ok' >> /home/sysop/.bashrc
sudo echo '[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor' >> /home/sysop/.bashrc
fi

View File

@ -18,5 +18,5 @@ rm -fr /home/sysop/.config/chromium/Default/
xrandr --output DSI-1 --rotate right xrandr --output DSI-1 --rotate right
# lance chromium avec un user agent spécifique hostname,password,periph,ip (provenant en partie de .chromium_env) # lance chromium avec un user agent spécifique hostname,password,periph,ip (provenant en partie de .chromium_env)
cd /home/sysop/serveurNfcNodeJs/ cd /home/sysop/serveurNfcNodeJsVma405/
node serveur_nfc.js node serveur_nfc.js

BIN
branchement_ecran_pi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 MiB

View File

@ -0,0 +1,248 @@
---
- hosts: dsi1024x600_vma405Pi2
remote_user: sysop
become: yes
tasks:
- name: Maj dépôts
apt:
upgrade: yes
update_cache: yes
- name: install "7zip"
apt:
name: p7zip-full
state: present
- name: install git
apt:
name: git
state: present
- name: install "xserver-xorg"
apt:
name: xserver-xorg
state: present
- name: install "x11-xserver-utils"
apt:
name: x11-xserver-utils
state: present
- name: install "xinit"
apt:
name: xinit
state: present
#
- name: install "openbox"
apt:
name: openbox
state: present
- name: install "chromium-browser"
apt:
name: chromium-browser
state: present
- name: install "xdotool"
apt:
name: xdotool
state: present
- name: Copie du fichier de démarrage automatique de Xorg
copy:
src: ./auto_startx_bashrc
dest: /home/sysop/auto_startx_bashrc
owner: sysop
group: sysop
mode: '0770'
backup: yes
- name: Ajout du fichier de démarrage automatique de Xorg au fichier .bashrc
shell: /home/sysop/auto_startx_bashrc
- name: Copie du fichier autostart
copy:
src: ./autostart
dest: /home/sysop/autostart
owner: sysop
group: sysop
mode: '0770'
backup: yes
- name: Remplacer le fichier autostart
shell:
cmd: cp /home/sysop/autostart /etc/xdg/openbox/autostart
- name: Copie du fichier serveurNfcNodeJsVma405.7z
copy:
src: ./serveurNfcNodeJsVma405.7z
dest: /home/sysop/serveurNfcNodeJsVma405.7z
owner: sysop
group: sysop
backup: yes
- name: décompresser le fichier serveurNfcNodeJsVma405.7z
shell:
cmd: 7z x serveurNfcNodeJsVma405.7z
- name: Changer les droits du dossier serveurNfcNodeJsVma405
shell:
cmd: chown -R sysop:sysop /home/sysop/serveurNfcNodeJsVma405
- name: Ajout du dépot nodes js
shell: curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
- name: install "nodejs"
apt:
name: nodejs
state: present
- name: Pour nodejs, installation de "gcc" pour la compilation
apt:
name: gcc
state: present
- name: Pour nodejs, installation de "g++" pour la compilation
apt:
name: g++
state: present
- name: Pour nodejs, installation de "make" pour la compilation
apt:
name: make
state: present
- name: Pour nodejs, installation de "apt-transport-https" pour la compilation
apt:
name: apt-transport-https
state: present
- name: Installer les modules du serveurNfcNodeJsVma405
shell:
cmd: npm i
chdir: /home/sysop/serveurNfcNodeJsVma405/
- name: Création du fichier de configuration
shell: cp chromium_env.exemple .chromium_env
args:
chdir: /home/sysop/serveurNfcNodeJsVma405/
- name: Modification du hostname du fichier de configuration
shell:
cmd: sed -i "s/__hostname__/{{ hostname }}/" /home/sysop/serveurNfcNodeJsVma405/.chromium_env
- name: Modification du mot de passe du fichier de configuration
shell:
cmd: sed -i "s/__mdp__/{{ password }}/" /home/sysop/serveurNfcNodeJsVma405/.chromium_env
- name: Modification du token wifi du fichier de configuration
shell:
cmd: sed -i "s/__token__/{{ token }}/" /home/sysop/serveurNfcNodeJsVma405/.chromium_env
- name: Modification du type de front du fichier de configuration
shell:
cmd: sed -i "s/__frontType__/{{ frontType }}/" /home/sysop/serveurNfcNodeJsVma405/.chromium_env
- name: Modification du protocole(serveur) du fichier de configuration
shell:
cmd: sed -i "s/__protocole__/{{ protocole }}/" /home/sysop/serveurNfcNodeJsVma405/.chromium_env
- name: Modification de l'adresse du serveur du fichier de configuration
shell:
cmd: sed -i "s/__serveur__/{{ serveur }}/" /home/sysop/serveurNfcNodeJsVma405/.chromium_env
- name: Création du dossier repos "7inch-DSI-LCD-C"
file:
path: /home/sysop/7inch-DSI-LCD-C
state: directory
mode: '0775'
- name: Rapatrier le driver de l'écran
git:
repo: https://github.com/waveshare/7inch-DSI-LCD-C.git
dest: /home/sysop/7inch-DSI-LCD-C/
clone: yes
update: no
- name: Installer le driver
shell: /home/sysop/7inch-DSI-LCD-C/32/5.10.103/pi3/WS_7inchDSI1024x600.sh
args:
chdir: /home/sysop/7inch-DSI-LCD-C/32/5.10.103/pi3/
- name: Ajouter la rotation de 90° au fichier de configuration /boot/config.txt
shell:
cmd: echo "#90°" >> /boot/config.txt && echo "dtoverlay=WS_7inchDSI1024x600_Touch,invertedx,swappedxy" >> /boot/config.txt
- name: installe "splash screen"
apt:
name: rpd-plym-splash
state: present
- name: Installation de "fbi", pour visualiser le splash screen(logo)
apt:
name: fbi
state: present
- name: install "xserver-xorg-video-fbturbo"
apt:
name: xserver-xorg-video-fbturbo
state: present
- name: Copie du fichier image splash.png
copy:
src: ./splash.png
dest: /home/sysop/splash.png
owner: sysop
group: sysop
backup: yes
- name: Suppression du logo raspberry pi, modification du fichier /boot/cmdline.txt
shell:
cmd: echo "\nconsoleblank=0 loglevel=1 quiet logo.nologo" >> /boot/cmdline.txt
- name: Autoriser startx
shell:
cmd: sed -i "s/quiet splash plymouth.ignore-serial-consoles//" /boot/cmdline.txt
- name: Copie du fichier du service "splashscreen.service"
copy:
src: ./splashscreen.service
dest: /etc/systemd/system/splashscreen.service
owner: sysop
group: sysop
mode: '0770'
backup: yes
- name: Activer "splashscreen.service"
shell:
cmd: sudo systemctl enable splashscreen.service
- name: Démarrer "splashscreen.service"
shell:
cmd: sudo systemctl start splashscreen.service
- name: Active SPI
shell:
cmd: echo "dtparam=spi=on" >> /boot/config.txt
- name: Auto-login
shell:
cmd: raspi-config nonint do_boot_behaviour B2
- name: Changer le propriétaire et le groupe dupériphérique
shell: chown root:gpio /dev/gpiomem
- name: Configurer les droits du groupe en lecture ecriture
shell: chmod g+rw /dev/gpiomem
- name: Ajout de l'utilisateur au groupe gpio
shell: usermod -a -G gpio $USER
- name: Ajout de l'utilisateur au groupe spi
shell: usermod -a -G spi $USER
- name: Ajout de l'utilisateur au groupe netdev
shell: usermod -a -G netdev $USER
- name: Redémarrage !
reboot:

View File

@ -1,47 +0,0 @@
---
- hosts: testDsiPi
remote_user: sysop
become: yes
tasks:
- name: install "splash screen"
apt:
name: rpd-plym-splash
state: present
- name: Active SPI
shell:
cmd: echo "dtparam=spi=on" >> /boot/config.txt
- name: Ajout du dépot nodes js
shell: curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
- name: install "nodejs"
apt:
name: nodejs
state: present
- name: Pour nodejs, installation de "gcc" pour la compilation
apt:
name: gcc
state: present
- name: Pour nodejs, installation de "g++" pour la compilation
apt:
name: g++
state: present
- name: Pour nodejs, installation de "make" pour la compilation
apt:
name: make
state: present
- name: Pour nodejs, installation de "apt-transport-https" pour la compilation
apt:
name: apt-transport-https
state: present
- name: Installation des modules node js
shell:
cmd: npm i
chdir: /home/sysop/nodeJsVma405/

View File

@ -13,10 +13,10 @@
<table> <table>
<tbody> <tbody>
<tr> <tr>
<td>39</td><td>37</td><td>35</td><td>33</td><td>31</td><td>29</td><td>27</td><td>25</td><td>SCK</td><td>MISO</td><td>MOSI</td><td>17</td><td>15</td><td>13</td><td>11</td><td>GND</td><td>7</td><td>5</td><td>3</td><td>vcc</td> <td>côté usb</td><td>39</td><td>37</td><td>35</td><td>33</td><td>31</td><td>29</td><td>27</td><td>25</td><td>SCK</td><td>MISO</td><td>MOSI</td><td>17</td><td>15</td><td>13</td><td>11</td><td>GND</td><td>7</td><td>5</td><td>3</td><td>vcc</td>
</tr> </tr>
<tr> <tr>
<td>40</td><td>38</td><td>36</td><td>34</td><td>32</td><td>30</td><td>28</td><td>26</td><td>NSS</td><td>RST</td><td>20</td><td>18</td><td>16</td><td>14</td><td>12</td><td>10</td><td>8</td><td>6</td><td>4</td><td>2</td> <td>reseau</td><td>40</td><td>38</td><td>36</td><td>34</td><td>32</td><td>30</td><td>28</td><td>26</td><td>NSS</td><td>RST</td><td>20</td><td>18</td><td>16</td><td>14</td><td>12</td><td>10</td><td>8</td><td>6</td><td>4</td><td>2</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
@ -25,25 +25,26 @@
<table> <table>
<thead> <thead>
<tr> <tr>
<th>VMA405</th><th>PI 3 B+</th><th>Couleur cable</th> <th>RC522 / VMA405</th><th>PI 3 B+</th><th>Couleur cable</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr><td>VCC</td><td>1</td><td>marron</td></tr> <tr><td>3.3v / VCC</td><td>1</td><td>rouge</td></tr>
<tr><td>RST</td><td>22</td><td>rouge</td></tr> <tr><td>RST</td><td>22</td><td>marron</td></tr>
<tr><td>GND</td><td>9</td><td>orange</td></tr> <tr><td>GND</td><td>9</td><td>noir</td></tr>
<tr><td>IRQ</td><td>pas utilisé</td><td></td></tr>
<tr><td>MISO</td><td>21</td><td>jaune</td></tr> <tr><td>MISO</td><td>21</td><td>jaune</td></tr>
<tr><td>MOSI</td><td>19</td><td>vert</td></tr> <tr><td>MOSI</td><td>19</td><td>vert</td></tr>
<tr><td>SCK</td><td>23</td><td>bleu</td></tr> <tr><td>SCK</td><td>23</td><td>bleu</td></tr>
<tr><td>NSS</td><td>24</td><td>violet</td></tr> <tr><td>SDA</td><td>24</td><td>violet</td></tr>
<tr><td>IRQ</td><td>pas utilisé<td></td></tr> <tbody>
</tbody>
</table> </table>
# installation de node js (ansible) # installation de node js (ansible)
node.yml install_1024x600_vma405_chromium.yml
# splash screen (écran de boot = pub) # splash screen (écran de boot = pub)
``` ```

BIN
rfid_rc522.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 KiB

BIN
serveurNfcNodeJsVma405.7z Normal file

Binary file not shown.

View File

@ -1,16 +1,16 @@
#cp chromium_env.exemple .chromium_env #cp chromium_env.exemple .chromium_env
#utilisateur #utilisateur
hostname = testDsiPi hostname = __hostname__
#front #front
front_type = FPI front_type = __frontType__
#url du serveur #url du serveur
url = https://django-local.org:8501/wv/login_hardware url = __protocole__://__serveur__/wv/login_hardware
#mode_nfc = NFCMO #mode_nfc = NFCMO
mode_nfc = NFCLO mode_nfc = NFCLO
password = xxxxxxxxxxxxxxxxxxxxx password = __mdp__
token = xxxxxxxxxxxxxxxxxx token = __token__

View File

@ -72,7 +72,6 @@ vma405Emitter.on('msgVma405', (msg) => {
}) })
// --- commandes système --- // --- commandes système ---
/** @function /** @function
* Obtenir ip extérieur (wan/box) * Obtenir ip extérieur (wan/box)
@ -434,6 +433,7 @@ function afficherFrontType() {
return 'inconnu' return 'inconnu'
} }
} }
function rnd(min, max) { function rnd(min, max) {
return Math.round(Math.random() * ((max + 1) - min) + min, 0); return Math.round(Math.random() * ((max + 1) - min) + min, 0);
} }
@ -500,19 +500,71 @@ token = ${ donnees.valeurs.token }
// --- serveur http --- // --- serveur http ---
let typeMime = { let typeMime = {
"aac":"audio/aac","abw":"application/x-abiword","arc":"application/octet-stream","avi":"video/x-msvideo","azw":"application/vnd.amazon.ebook", "aac": "audio/aac",
"bin":"application/octet-stream","bz":"application/x-bzip","bz2":"application/x-bzip2","csh":"application/x-csh","css":"text/css","csv":"text/csv", "abw": "application/x-abiword",
"doc":"application/msword","docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","eot":"application/vnd.ms-fontobject", "arc": "application/octet-stream",
"epub":"application/epub+zip","gif":"image/gif","htm":"text/html","html":"text/html","ico":"image/x-icon","ics":"text/calendar","jar":"application/java-archive", "avi": "video/x-msvideo",
"jpeg":"image/jpeg","jpeg":"image/jpeg","js":"application/javascript","json":"application/json","mid":"audio/midi","midi":"audio/midi","mpeg":"video/mpeg", "azw": "application/vnd.amazon.ebook",
"mpkg":"application/vnd.apple.installer+xml","odp":"application/vnd.oasis.opendocument.presentation","ods":"application/vnd.oasis.opendocument.spreadsheet", "bin": "application/octet-stream",
"odt":"application/vnd.oasis.opendocument.text","oga":"audio/ogg","ogv":"video/ogg","ogx":"application/ogg","otf":"font/otf","png":"image/png","pdf":"application/pdf", "bz": "application/x-bzip",
"ppt":"application/vnd.ms-powerpoint","pptx":"application/vnd.openxmlformats-officedocument.presentationml.presentation","rar":"application/x-rar-compressed", "bz2": "application/x-bzip2",
"rtf":"application/rtf","sh":"application/x-sh","svg":"image/svg+xml","swf":"application/x-shockwave-flash","tar":"application/x-tar","tif":"image/tiff", "csh": "application/x-csh",
"tiff":"image/tiff","ts":"application/typescript","ttf":"font/ttf","vsd":"application/vnd.visio","wav":"audio/x-wav","weba":"audio/webm","webm":"video/webm", "css": "text/css",
"webp":"image/webp","woff":"font/woff","woff2":"font/woff2","xhtml":"application/xhtml+xml","xls":"application/vnd.ms-excel", "csv": "text/csv",
"xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","xml":"application/xml","xul":"application/vnd.mozilla.xul+xml","zip":"application/zip", "doc": "application/msword",
"3gp":"video/3gpp audio/3gpp","3g2":"video/3gpp2 audio/3gpp2", "docx": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"eot": "application/vnd.ms-fontobject",
"epub": "application/epub+zip",
"gif": "images/gif",
"htm": "text/html",
"html": "text/html",
"ico": "images/x-icon",
"ics": "text/calendar",
"jar": "application/java-archive",
"jpeg": "images/jpeg",
"jpeg": "images/jpeg",
"js": "application/javascript",
"json": "application/json",
"mid": "audio/midi",
"midi": "audio/midi",
"mpeg": "video/mpeg",
"mpkg": "application/vnd.apple.installer+xml",
"odp": "application/vnd.oasis.opendocument.presentation",
"ods": "application/vnd.oasis.opendocument.spreadsheet",
"odt": "application/vnd.oasis.opendocument.text",
"oga": "audio/ogg",
"ogv": "video/ogg",
"ogx": "application/ogg",
"otf": "font/otf",
"png": "images/png",
"pdf": "application/pdf",
"ppt": "application/vnd.ms-powerpoint",
"pptx": "application/vnd.openxmlformats-officedocument.presentationml.presentation",
"rar": "application/x-rar-compressed",
"rtf": "application/rtf",
"sh": "application/x-sh",
"svg": "images/svg+xml",
"swf": "application/x-shockwave-flash",
"tar": "application/x-tar",
"tif": "images/tiff",
"tiff": "images/tiff",
"ts": "application/typescript",
"ttf": "font/ttf",
"vsd": "application/vnd.visio",
"wav": "audio/x-wav",
"weba": "audio/webm",
"webm": "video/webm",
"webp": "images/webp",
"woff": "font/woff",
"woff2": "font/woff2",
"xhtml": "application/xhtml+xml",
"xls": "application/vnd.ms-excel",
"xlsx": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
"xml": "application/xml",
"xul": "application/vnd.mozilla.xul+xml",
"zip": "application/zip",
"3gp": "video/3gpp audio/3gpp",
"3g2": "video/3gpp2 audio/3gpp2",
"7z": "application/x-7z-compressed" "7z": "application/x-7z-compressed"
} }

View File

@ -1,7 +1,6 @@
// si problême de droit // si problême de droit
// sudo chown root:gpio /dev/gpiomem // sudo chown root:gpio /dev/gpiomem
// sudo chmod g+rw /dev/gpiomem // sudo chmod g+rw /dev/gpiomem
// sudo chmod g+rw /dev/gpiomem
// sudo usermod -a -G gpio $USER // sudo usermod -a -G gpio $USER
// sudo usermod -a -G spi $USER // sudo usermod -a -G spi $USER
// sudo usermod -a -G netdev $USER // sudo usermod -a -G netdev $USER

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -10,7 +10,7 @@
<header class="l100p fond-header"> <header class="l100p fond-header">
<nav class="navbar-horizontal"> <nav class="navbar-horizontal">
<div class="navbar-img BF-col curseur-action" onclick="window.location.reload();"> <div class="navbar-img BF-col curseur-action" onclick="window.location.reload();">
<img alt="TiBillet" src="images/logo_115x46.png"/> <img alt="TiBillet" src="images/logo.png"/>
</div> </div>
<div class="navbar-nom BF-ligne"> <div class="navbar-nom BF-ligne">
<h1>{{ nomAppareil }}</h1> <h1>{{ nomAppareil }}</h1>

10
splashscreen.service Normal file
View File

@ -0,0 +1,10 @@
[Unit]
Description=Splash screen
DefaultDependencies=no
After=local-fs.target
[Service]
ExecStart=/usr/bin/fbi -d /dev/fb0 --noverbose -a /home/sysop/splash.png
StandardInput=tty
StandardOutput=tty
[Install]
WantedBy=sysinit.target

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 KiB

After

Width:  |  Height:  |  Size: 796 KiB

View File

@ -1,7 +1,6 @@
// si problême de droit // si problême de droit
// sudo chown root:gpio /dev/gpiomem // sudo chown root:gpio /dev/gpiomem
// sudo chmod g+rw /dev/gpiomem // sudo chmod g+rw /dev/gpiomem
// sudo chmod g+rw /dev/gpiomem
// sudo usermod -a -G gpio $USER // sudo usermod -a -G gpio $USER
// sudo usermod -a -G spi $USER // sudo usermod -a -G spi $USER
// sudo usermod -a -G netdev $USER // sudo usermod -a -G netdev $USER