dashboard.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. - name: Fetch Uchiwa from GitHub
  36. command: go get github.com/sensu/uchiwa
  37. environment:
  38. GOPATH: "{{ uchiwa_path }}/go"
  39. args:
  40. creates: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa"
  41. notify: Build and deploy Uchiwa
  42. become: true
  43. become_user: "{{ sensu_user_name }}"
  44. - meta: flush_handlers
  45. - name: Deploy Uchiwa config
  46. template:
  47. src: uchiwa_config.json.j2
  48. dest: "{{ uchiwa_path }}/etc/config.json"
  49. owner: "{{ sensu_user_name }}"
  50. group: "{{ sensu_group_name }}"
  51. notify: restart uchiwa service
  52. - name: Deploy Uchiwa service script
  53. template:
  54. src: uchiwa.sh.j2
  55. dest: /opt/local/lib/svc/method/uchiwa
  56. owner: root
  57. group: root
  58. mode: 0755
  59. notify: restart uchiwa service
  60. - name: Deploy Uchiwa service manifest
  61. template:
  62. dest: /opt/local/lib/svc/manifest/uchiwa.xml
  63. src: uchiwa.smartos_smf_manifest.xml.j2
  64. owner: root
  65. group: root
  66. mode: 644
  67. notify: import uchiwa service
  68. - meta: flush_handlers
  69. - name: Ensure Uchiwa server service is running
  70. service: name=uchiwa state=started enabled=yes