dashboard.yml 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. ---
  2. # tasks/SmartOS/dashboard.yml: Deployment of the Uchiwa dashboard
  3. # Specific to Joyent SmartOS
  4. - include_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:
  9. dest: "{{ uchiwa_path }}"
  10. state: directory
  11. owner: "{{ sensu_user_name }}"
  12. group: "{{ sensu_group_name }}"
  13. recurse: true
  14. - name: Ensure Uchiwa Go/config directory exists
  15. file:
  16. dest: "{{ uchiwa_path }}/{{ item }}"
  17. state: directory
  18. owner: "{{ sensu_user_name }}"
  19. group: "{{ sensu_group_name }}"
  20. recurse: true
  21. with_items:
  22. - etc
  23. - go
  24. - name: Ensure Uchiwa GOPATH exists
  25. file:
  26. dest: "{{ uchiwa_path }}/go/{{ item }}"
  27. owner: "{{ sensu_user_name }}"
  28. group: "{{ sensu_group_name }}"
  29. state: directory
  30. recurse: true
  31. with_items:
  32. - bin
  33. - pkg
  34. - src
  35. - block:
  36. - name: Fetch Uchiwa from GitHub
  37. command: go get github.com/sensu/uchiwa
  38. environment:
  39. GOPATH: "{{ uchiwa_path }}/go"
  40. args:
  41. creates: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa"
  42. - name: Build and deploy Uchiwa
  43. shell: npm install --production
  44. args:
  45. chdir: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa"
  46. creates: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa/public/bower_components"
  47. become: true
  48. become_user: "{{ sensu_user_name }}"
  49. - name: Deploy Uchiwa config
  50. template:
  51. src: uchiwa_config.json.j2
  52. dest: "{{ uchiwa_path }}/etc/config.json"
  53. owner: "{{ sensu_user_name }}"
  54. group: "{{ sensu_group_name }}"
  55. notify: restart uchiwa service
  56. - name: Deploy Uchiwa service script
  57. template:
  58. src: uchiwa.sh.j2
  59. dest: /opt/local/lib/svc/method/uchiwa
  60. owner: root
  61. group: root
  62. mode: 0755
  63. notify: restart uchiwa service
  64. - name: Deploy Uchiwa service manifest
  65. template:
  66. dest: /opt/local/lib/svc/manifest/uchiwa.xml
  67. src: uchiwa.smartos_smf_manifest.xml.j2
  68. owner: root
  69. group: root
  70. mode: 644
  71. notify: import uchiwa service
  72. - meta: flush_handlers
  73. - name: Ensure Uchiwa server service is running
  74. service: name=uchiwa state=started enabled=yes