Commit 5836ec076353692afd387ca74284d5112b3af2f2
1 parent
47b8fe63
Test de lancement d'Ansible depuis le site
Showing
2 changed files
with
20 additions
and
19 deletions
Show diff stats
site/reception.php
... | ... | @@ -46,30 +46,31 @@ if(isset($_POST['sensor'])) |
46 | 46 | |
47 | 47 | if(!$err) |
48 | 48 | { |
49 | - file_put_contents('upload/inventaire.ini', $ini) | |
50 | - $upload = load($_FILES['fichier']['tmp_name'], $_FILES['fichier']['name']); | |
51 | - if($upload) | |
52 | - { | |
53 | - $message = "Upload du fichier réussi !"; | |
54 | - $color = "alert-success"; | |
55 | - $cmd = "ansible-playbook ../Ansible/taskPing.yml -i upload/inventaire.ini"; | |
56 | - if(shell_exec($cmd)==NULL) | |
49 | + if(file_put_contents('upload/inventaire.ini', $ini)!=NULL) | |
50 | + { | |
51 | + $upload = load($_FILES['fichier']['tmp_name'], $_FILES['fichier']['name']); | |
52 | + if($upload) | |
57 | 53 | { |
58 | - // Gestion de l'erreur | |
59 | - $message = $message." Echec du lancement d'Ansible !"; | |
60 | - $color = "alert-danger"; | |
54 | + $message = "Upload du fichier réussi !"; | |
55 | + $color = "alert-success"; | |
56 | + $cmd = "ansible-playbook ../Ansible/taskPing.yml -i upload/inventaire.ini"; | |
57 | + /*if(shell_exec($cmd)==NULL) | |
58 | + { | |
59 | + // gestion de l'erreur | |
60 | + $message = $message." Ansible est lancé !"; | |
61 | + } | |
62 | + else | |
63 | + { | |
64 | + $message = $message." Echec du lancement d'Ansible !"; | |
65 | + $color = "alert-danger"; | |
66 | + }*/ | |
61 | 67 | } |
62 | 68 | else |
63 | 69 | { |
64 | - // Réussite | |
65 | - $message = $message." Ansible est lancé !"; | |
70 | + $message = "Erreur lors du transfert du fichier..."; | |
71 | + $color = "alert-danger"; | |
66 | 72 | } |
67 | 73 | } |
68 | - else | |
69 | - { | |
70 | - $message = "Erreur lors du transfert du fichier..."; | |
71 | - $color = "alert-danger"; | |
72 | - } | |
73 | 74 | } |
74 | 75 | else |
75 | 76 | { | ... | ... |
site/tableau.php
1 | 1 | <div class="row"> |
2 | 2 | <div class="col-4 col-md-4 offset-4 offset-md-4"> |
3 | - <h1 style="margin-bottom:20px; margin-top:20px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fa fa-info-circle"></i> Informations complémentaires</h1> | |
3 | + <h1 style="margin-bottom:20px; margin-top:60px; border-bottom:1px solid #CCC; padding-bottom:20px;"><i class="fa fa-info-circle"></i> Informations complémentaires</h1> | |
4 | 4 | <table class="table table-striped table-bordered"> |
5 | 5 | <tbody> |
6 | 6 | <tr> | ... | ... |