install.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. ---
  2. - hosts: localhost
  3. gather_facts: no
  4. connection: local
  5. vars:
  6. - git_url: "git@github.com:kalliope-project/kalliope.git"
  7. - temp_local_repo: "/tmp/kalliope_repo"
  8. tasks:
  9. - name: clone project in /tmp as standart user
  10. git:
  11. repo: "{{ git_url }}"
  12. dest: /tmp/kalliope_repo
  13. accept_hostkey: yes
  14. - hosts: localhost
  15. gather_facts: no
  16. connection: local
  17. become: True
  18. vars:
  19. - git_url: "git@github.com:kalliope-project/kalliope.git"
  20. - temp_local_repo: "/tmp/kalliope_repo"
  21. - install_path: "/usr/lib/kalliope"
  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. - libatlas3-base
  40. - name: Copy requirement
  41. copy:
  42. src: python_requirements.txt
  43. dest: /tmp/requirements.txt
  44. - name: Upgrade pip
  45. pip:
  46. name: pip
  47. state: latest
  48. - name: Install python libs
  49. pip:
  50. requirements=/tmp/requirements.txt
  51. - name: Check that the repo has been cloned
  52. stat:
  53. path: "{{ temp_local_repo }}"
  54. register: git_repo_stat
  55. - name: Remove old version if exist
  56. file:
  57. path: "{{ install_path }}"
  58. state: absent
  59. - name: Move repo in /usr/lib
  60. command: mv "{{ temp_local_repo }}" "{{ install_path }}"
  61. when: git_repo_stat.stat.exists
  62. - name: Add entry in /usr/bin
  63. file:
  64. src: "{{ install_path }}/kalliope.py"
  65. dest: /usr/bin/kalliope
  66. state: link
  67. force: True