dashboard.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. ---
  2. # tasks/SmartOS/dashboard.yml: Deployment of the Uchiwa dashboard
  3. # Specific to Joyent SmartOS
  4. - name: Ensure Uchiwa (dashboard) dependencies are installed
  5. pkgin: name=go state=present
  6. - name: Ensure Uchiwa directory exists
  7. file: dest={{ uchiwa_path }} state=directory
  8. owner={{ sensu_user_name }} group={{ sensu_group_name }}
  9. recurse=yes
  10. - name: Ensure Uchiwa config directory exists
  11. file: dest={{ uchiwa_path }}/etc state=directory
  12. owner={{ sensu_user_name }} group={{ sensu_group_name }}
  13. recurse=yes
  14. - name: Ensure Uchiwa Go directory exists
  15. file: dest={{ uchiwa_path }}/go state=directory
  16. owner={{ sensu_user_name }} group={{ sensu_group_name }}
  17. recurse=yes
  18. - name: Ensure Uchiwa GOPATH exists
  19. file: dest={{ uchiwa_path }}/go/{{ item }}
  20. owner={{ sensu_user_name }}
  21. group={{ sensu_group_name }}
  22. state=directory recurse=yes
  23. with_items:
  24. - bin
  25. - pkg
  26. - src
  27. - name: Fetch Uchiwa from GitHub
  28. command: go get github.com/sensu/uchiwa
  29. environment:
  30. GOPATH: "{{ uchiwa_path }}/go"
  31. sudo: yes
  32. sudo_user: "{{ sensu_user_name }}"
  33. args:
  34. creates: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa"
  35. - name: Build and deploy Uchiwa
  36. shell: npm install --production chdir={{ uchiwa_path }}/go/src/github.com/sensu/uchiwa
  37. args:
  38. creates: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa/public/bower_components"
  39. sudo: yes
  40. sudo_user: "{{ sensu_user_name }}"
  41. - name: Deploy Uchiwa config
  42. template: src=uchiwa_config.json.j2 dest={{ uchiwa_path }}/etc/config.json
  43. owner={{ sensu_user_name }} group={{ sensu_group_name }}
  44. notify: restart uchiwa service
  45. - name: Deploy Uchiwa service script
  46. template: src=uchiwa.sh.j2
  47. dest=/opt/local/lib/svc/method/uchiwa
  48. owner=root group=root mode=755
  49. notify: restart uchiwa service
  50. - name: Deploy Uchiwa service manifest
  51. template: dest=/opt/local/lib/svc/manifest/uchiwa.xml
  52. src=uchiwa.smartos_smf_manifest.xml.j2
  53. owner=root group=root mode=644
  54. notify: import uchiwa service
  55. - name: Initial import of Uchiwa server service
  56. command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/uchiwa.xml
  57. args:
  58. creates: "/var/svc/log/application-uchiwa:default.log"
  59. - name: Ensure Uchiwa server service is running
  60. service: name=uchiwa state=started enabled=yes