main.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. ---
  2. # tasks file for meshviewer
  3. - include_vars: "{{ ansible_os_family}}.yml"
  4. - name: Install build dependencies
  5. apt: name={{item}} state=present
  6. with_items: "{{meshviewer_build_dependencies}}"
  7. #- name: Fix annoying bug debians node package
  8. # when: ansible_os_family == 'Debian'
  9. # file: dest=/usr/bin/node src=/usr/bin/nodejs state=link
  10. - name: Create meshviewer install directory
  11. file: name={{meshviewer_install_directory}} state=directory
  12. - name: Create meshviewer build directory
  13. file: name={{meshviewer_build_directory}} state=directory
  14. - name: Clone meshviewer
  15. register: meshviewer_cloned
  16. git: repo={{meshviewer_repo}} dest={{meshviewer_build_directory}} version={{meshviewer_version}}
  17. - name: Install npm build dependencies
  18. command: npm install
  19. when: meshviewer_cloned|changed
  20. register: meshviewer_npm_installed
  21. args:
  22. chdir: "{{meshviewer_build_directory}}/"
  23. creates: "{{meshviewer_build_directory}}/node_modules"
  24. - name: Install bower and grunt
  25. when: meshviewer_npm_installed|changed
  26. command: npm install bower grunt-cli
  27. args:
  28. chdir: "{{meshviewer_build_directory}}"
  29. - name: Install frontend dependencies
  30. command: node_modules/.bin/bower --allow-root --config.interactive=false install
  31. args:
  32. chdir: "{{meshviewer_build_directory}}/"
  33. creates: "{{meshviewer_build_directory}}/bower_components"
  34. - name: Install build config
  35. template: src=config.js.j2 dest="{{meshviewer_build_directory}}/config.js"
  36. - name: Build meshviewer
  37. command: node_modules/.bin/grunt
  38. args:
  39. chdir: "{{meshviewer_build_directory}}/"
  40. creates: "{{meshviewer_build_directory}}/build"
  41. - name: Copy meshviewer into install directory
  42. shell: cp -r {{meshviewer_build_directory}}/build/* {{meshviewer_install_directory}}