From 8fb6b9d187b75779da145013cd0e85ed810eb850 Mon Sep 17 00:00:00 2001 From: psanchez Date: Mon, 2 Mar 2020 15:37:24 +0000 Subject: [PATCH] modification des taches + test telechargement des fichiers pour envoi --- Ansible/MainTask.yml | 28 ++++++++++++++++++++++++++++ Ansible/inventaire.ini | 8 ++++---- Ansible/my_task.yml | 9 --------- Ansible/roles/arduino/tasks/main.yml | 16 +++++++++++++++- Ansible/roles/arduino_Setup/tasks/main.yml | 3 +-- Ansible/taskPing.yml | 18 ++++++++++++++++-- 6 files changed, 64 insertions(+), 18 deletions(-) create mode 100644 Ansible/MainTask.yml delete mode 100644 Ansible/my_task.yml diff --git a/Ansible/MainTask.yml b/Ansible/MainTask.yml new file mode 100644 index 0000000..9b2de7a --- /dev/null +++ b/Ansible/MainTask.yml @@ -0,0 +1,28 @@ +--- +- name: "Setup des Raspberry pi pour capteur Arduino" + hosts: Arduino_init + remote_user: pi + become: yes + roles: + - role: arduino_Setup + +- name: "Setup des Raspberry pi pour capteur Nucleo" + hosts: Nucleo_init + remote_user: pi + become: yes + roles: + - role: nucleo_Setup + +- name: "Déploiement de code pour Arduino" + hosts: Arduino + remote_user: pi + become: yes + roles: + - role: arduino + +- name: "Déploiement de code pour Nucleo" + hosts: Nucleo + remote_user: pi + become: yes + roles: + - role: nucleo \ No newline at end of file diff --git a/Ansible/inventaire.ini b/Ansible/inventaire.ini index 396c124..733c323 100644 --- a/Ansible/inventaire.ini +++ b/Ansible/inventaire.ini @@ -1,6 +1,6 @@ -[Raspberry] -rasp1 capteur1=1 +[Arduino_init] +rasp1 rasp2 -[autretruc] -rasp1 \ No newline at end of file +[Arduino] +rasp1 capteur1=1 \ No newline at end of file diff --git a/Ansible/my_task.yml b/Ansible/my_task.yml deleted file mode 100644 index 70d470e..0000000 --- a/Ansible/my_task.yml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: "Deploiement de code sur Raspberry" - hosts: Raspberry - remote_user: pi - become: yes - roles: - - role: arduino_Setup - - \ No newline at end of file diff --git a/Ansible/roles/arduino/tasks/main.yml b/Ansible/roles/arduino/tasks/main.yml index 139597f..2e2534d 100644 --- a/Ansible/roles/arduino/tasks/main.yml +++ b/Ansible/roles/arduino/tasks/main.yml @@ -1,2 +1,16 @@ +--- +- name: "envoyer d'un fichier vers arduino cpt1" + get_url: + url: http://serveur-etu.polytech-lille.fr/~grouille/PROJET/upload/binaire.c + dest: /home/pi/capteur1/binaire.c + mode: '0440' + when: capteur1 is undefined - +- name: "envoyer d'un fichier vers arduino cpt2" + copy: + src: ../files/proxy.conf + dest: /home/pi/capteur2/makefile + owner: root + group: root + mode: '0644' + when: capteur2 is undefined \ No newline at end of file diff --git a/Ansible/roles/arduino_Setup/tasks/main.yml b/Ansible/roles/arduino_Setup/tasks/main.yml index b1f011d..ed58237 100644 --- a/Ansible/roles/arduino_Setup/tasks/main.yml +++ b/Ansible/roles/arduino_Setup/tasks/main.yml @@ -1,12 +1,11 @@ --- -- name: Copy file for proxy setup +- name: "Copy file for proxy setup" copy: src: ../files/proxy.conf dest: /etc/apt/apt.conf.d/proxy.conf owner: root group: root mode: '0644' - when: capteur1 is undefined - name: "verif install python3" apt: diff --git a/Ansible/taskPing.yml b/Ansible/taskPing.yml index 54d3dc9..383eeca 100644 --- a/Ansible/taskPing.yml +++ b/Ansible/taskPing.yml @@ -1,6 +1,20 @@ --- - name: Ping - hosts: all + hosts: localhost remote_user: pi tasks: - - ping: \ No newline at end of file + - ping: + +- name: "envoyer d'un fichier vers arduino cpt1" + hosts: localhost + tasks: + - file: + path: /home/pifou/Documents/test + state: directory + mode: 0755 + group: pifou + owner: pifou + - get_url: + url: http://serveur-etu.polytech-lille.fr/~grouille/PROJET/upload/binaire.c + dest: /home/pifou/Documents/test/binaire.c + mode: '0440' \ No newline at end of file -- libgit2 0.21.2