dashboard.yml 2.5 KB

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