From b05b0dc5f7e46c9bc38f48070d150f65d913c98f Mon Sep 17 00:00:00 2001 From: psanchez Date: Wed, 19 Feb 2020 17:15:35 +0000 Subject: [PATCH] gestion des roles --- Ansible/execAnsible.sh | 14 ++++++++------ Ansible/inventaire.ini | 6 ++++++ Ansible/my_task.yml | 9 +++++++++ Ansible/playbooktest.yml | 4 ++-- Ansible/roles/arduino/tasks/main.yml | 2 ++ Ansible/roles/arduino_Setup/files/proxy.conf | 2 ++ Ansible/roles/arduino_Setup/tasks/main.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 Ansible/inventaire.ini create mode 100644 Ansible/roles/arduino/tasks/main.yml create mode 100644 Ansible/roles/arduino_Setup/files/proxy.conf create mode 100644 Ansible/roles/arduino_Setup/tasks/main.yml diff --git a/Ansible/execAnsible.sh b/Ansible/execAnsible.sh index 69e1203..d5f3fe9 100755 --- a/Ansible/execAnsible.sh +++ b/Ansible/execAnsible.sh @@ -1,7 +1,9 @@ #!/bin/bash -while [ 1 ] -do -ansible-playbook playbooktest.yml -ansible-playbook taskPing.yml -i inventaire.ini --ask-pass -rm inventaire.ini -done \ No newline at end of file +trap exit SIGINT +#while [ 1 ] +#do +#ansible-playbook playbooktest.yml +#ansible-playbook taskPing.yml -i inventaire.ini --ask-pass +ansible-playbook my_task.yml -i inventaire.ini +#rm inventaire.ini +#done \ No newline at end of file diff --git a/Ansible/inventaire.ini b/Ansible/inventaire.ini new file mode 100644 index 0000000..a29b964 --- /dev/null +++ b/Ansible/inventaire.ini @@ -0,0 +1,6 @@ +[Raspberry] +rasp1 +rasp2 + +[autretruc] +rasp1 \ No newline at end of file diff --git a/Ansible/my_task.yml b/Ansible/my_task.yml index e69de29..70d470e 100644 --- a/Ansible/my_task.yml +++ b/Ansible/my_task.yml @@ -0,0 +1,9 @@ +--- +- 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/playbooktest.yml b/Ansible/playbooktest.yml index 2c98aec..7846f28 100644 --- a/Ansible/playbooktest.yml +++ b/Ansible/playbooktest.yml @@ -1,6 +1,6 @@ --- -- name: Wait until the file /home/pifou/inventaire.ini +- name: Wait until the file ./inventaire.ini hosts: localhost tasks: - wait_for: - path: /home/pifou/inventaire.ini \ No newline at end of file + path: ./inventaire.ini \ No newline at end of file diff --git a/Ansible/roles/arduino/tasks/main.yml b/Ansible/roles/arduino/tasks/main.yml new file mode 100644 index 0000000..139597f --- /dev/null +++ b/Ansible/roles/arduino/tasks/main.yml @@ -0,0 +1,2 @@ + + diff --git a/Ansible/roles/arduino_Setup/files/proxy.conf b/Ansible/roles/arduino_Setup/files/proxy.conf new file mode 100644 index 0000000..f118531 --- /dev/null +++ b/Ansible/roles/arduino_Setup/files/proxy.conf @@ -0,0 +1,2 @@ +Acquire::http::Proxy "http://proxy.polytech-lille.fr:3128/"; +Acquire::https::Proxy "https://proxy.polytech-lille.fr:3128/"; diff --git a/Ansible/roles/arduino_Setup/tasks/main.yml b/Ansible/roles/arduino_Setup/tasks/main.yml new file mode 100644 index 0000000..0ba4a5a --- /dev/null +++ b/Ansible/roles/arduino_Setup/tasks/main.yml @@ -0,0 +1,43 @@ +--- +- 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' + +- name: "verif install python3" + apt: + name: python3 + state: present + +- name: "verif install python3-pip" + apt: + name: python3-pip + state: present + +- name: "verif install minicom" + apt: + name: minicom + state: present + +- name: "verif install wiringpi" + apt: + name: wiringpi + state: present + +- name: "verif install avrdude" + apt: + name: avrdude + state: present + +- name: "verif install lxml pkg" + pip: + executable: pip3 + name: lxml + +- name: "verif install requests pkg" + pip: + executable: pip3 + name: requests \ No newline at end of file -- libgit2 0.21.2