main.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. ---
  2. - name: Create HopGlass directory if not existent
  3. file:
  4. path: /opt/hopglass/client
  5. state: directory
  6. - name: Git for HopGlass
  7. git:
  8. repo: https://github.com/FreiFunkMuenster/hopglass.git
  9. dest: /opt/hopglass/client
  10. force: yes
  11. version: ffms
  12. register: hopglass_git_clone
  13. - name: Create hwpics directory if not exists
  14. file:
  15. path: /opt/hopglass/hwpics
  16. state: directory
  17. - name: Clone meshviewer hwpics repo
  18. git:
  19. repo: https://github.com/Moorviper/meshviewer_hwpics.git
  20. dest: /opt/hopglass/hwpics
  21. update: yes
  22. register: hopglass_git_clone
  23. - name: Add nodejs repo keys
  24. apt_key:
  25. id: 1655A0AB68576280
  26. url: "https://deb.nodesource.com/gpgkey/nodesource.gpg.key"
  27. state: present
  28. - name: Add repo for nodejs
  29. apt_repository:
  30. repo: "{{ item }}"
  31. state: present
  32. update_cache: yes
  33. with_items:
  34. - "deb https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main"
  35. - "deb-src https://deb.nodesource.com/node_6.x {{ ansible_distribution_release }} main"
  36. - name: Install nodejs
  37. apt:
  38. pkg: nodejs
  39. state: installed
  40. - name: Install dependencies
  41. shell: npm install
  42. args:
  43. chdir: /opt/hopglass/client
  44. when: hopglass_git_clone.changed
  45. - name: Install grunt-cli
  46. shell: npm install grunt-cli
  47. args:
  48. chdir: /opt/hopglass/client
  49. when: hopglass_git_clone.changed
  50. - name: Build HopGlass
  51. shell: node_modules/.bin/grunt
  52. args:
  53. chdir: /opt/hopglass/client
  54. when: hopglass_git_clone.changed
  55. - name: Adjust permissions
  56. file:
  57. path: /opt/hopglass/client
  58. owner: hopglass
  59. group: hopglass
  60. recurse: yes
  61. when: hopglass_git_clone.changed
  62. - name: Create directory
  63. file:
  64. path: /opt/hopglass/client/build/
  65. state: directory
  66. - name: Deploy config.json
  67. template:
  68. src: config.json.j2
  69. dest: /opt/hopglass/client/build/config.json
  70. owner: hopglass
  71. group: hopglass
  72. mode: 0644
  73. - name: Create directory for domainspecific config files
  74. file:
  75. path: /opt/hopglass/client/build/config/
  76. state: directory
  77. - name: Deploy config.json domainspecific
  78. template:
  79. src: configdom.json.j2
  80. dest: "/opt/hopglass/client/build/config/config_{{item[0]}}.json"
  81. owner: hopglass
  82. group: hopglass
  83. mode: 0644
  84. with_items:
  85. - "{{domaenen|dictsort}}"
  86. - name: Generate list of all community names
  87. set_fact:
  88. communities: "{{ domaenen | list | map('extract', domaenen, 'community') | list | unique | sort }}"
  89. - name: Deploy config.json configcommunity
  90. template:
  91. src: configcommunity.json.j2
  92. dest: "/opt/hopglass/client/build/config/config_{{item}}.json"
  93. owner: hopglass
  94. group: hopglass
  95. mode: 0644
  96. when: item != "None"
  97. with_items:
  98. - "{{communities}}"