install.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. ---
  2. - hosts: localhost
  3. gather_facts: no
  4. connection: local
  5. vars:
  6. - git_url: "git@gitlab.pwit.fr:millionsfortomorrow/jarvis.git"
  7. - temp_local_repo: "/tmp/jarvis_repo"
  8. tasks:
  9. - name: clone project in /tmp as standart user
  10. git:
  11. repo: "{{ git_url }}"
  12. dest: /tmp/jarvis_repo
  13. accept_hostkey: yes
  14. - hosts: localhost
  15. gather_facts: no
  16. connection: local
  17. become: True
  18. vars:
  19. - git_url: "git@gitlab.pwit.fr:millionsfortomorrow/jarvis.git"
  20. - temp_local_repo: "/tmp/jarvis_repo"
  21. - jarvis_install_path: "/usr/lib/jarvis"
  22. tasks:
  23. - name: Install packages
  24. apt: name={{ item }} update_cache=yes
  25. with_items:
  26. - python-pip
  27. - python-dev
  28. - libsmpeg0
  29. - libttspico-utils
  30. - libsmpeg0
  31. - flac
  32. - dialog
  33. - libffi-dev
  34. - portaudio19-dev
  35. - build-essential
  36. - libssl-dev
  37. - libffi-dev
  38. - sox
  39. - name: Copy requirement
  40. copy:
  41. src: python_requirements.txt
  42. dest: /tmp/requirements.txt
  43. - name: Upgrade pip
  44. pip:
  45. name: pip
  46. state: latest
  47. - name: Install python libs
  48. pip:
  49. requirements=/tmp/requirements.txt
  50. - name: Check that the repo has been cloned
  51. stat:
  52. path: "{{ temp_local_repo }}"
  53. register: git_repo_stat
  54. - name: Remove old version if exist
  55. file:
  56. path: "{{ jarvis_install_path }}"
  57. state: absent
  58. - name: Move repo in /usr/lib
  59. command: mv "{{ temp_local_repo }}" "{{ jarvis_install_path }}"
  60. when: git_repo_stat.stat.exists
  61. - name: Add entry in /usr/bin
  62. file:
  63. src: "{{ jarvis_install_path }}/jarvis.py"
  64. dest: /usr/bin/jarvis
  65. state: link
  66. force: True