dashboard.yml 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. ---
  2. # tasks/FreeBSD/dashboard.yml: Deployment of the Uchiwa dashboard
  3. # Specific to FreeBSD
  4. - name: Include ansible_distribution vars
  5. include_vars: "{{ ansible_distribution }}.yml"
  6. tags: dashboard
  7. - name: Ensure Uchiwa (dashboard) dependencies are installed
  8. tags: dashboard
  9. pkgng:
  10. name: "{{ item }}"
  11. state: present
  12. with_items:
  13. - go
  14. - git
  15. - npm
  16. - name: Ensure Uchiwa directory exists
  17. tags: dashboard
  18. file:
  19. dest: "{{ uchiwa_path }}"
  20. state: directory
  21. owner: "{{ sensu_user_name }}"
  22. group: "{{ sensu_group_name }}"
  23. recurse: true
  24. - name: Ensure Uchiwa Go/config directory exists
  25. tags: dashboard
  26. file:
  27. dest: "{{ uchiwa_path }}/{{ item }}"
  28. state: directory
  29. owner: "{{ sensu_user_name }}"
  30. group: "{{ sensu_group_name }}"
  31. recurse: true
  32. with_items:
  33. - etc
  34. - go
  35. - name: Ensure Uchiwa GOPATH exists
  36. tags: dashboard
  37. file:
  38. dest: "{{ uchiwa_path }}/go/{{ item }}"
  39. owner: "{{ sensu_user_name }}"
  40. group: "{{ sensu_group_name }}"
  41. state: directory
  42. recurse: true
  43. with_items:
  44. - bin
  45. - pkg
  46. - src
  47. - name: Fetch Uchiwa from GitHub
  48. tags: dashboard
  49. command: go get github.com/sensu/uchiwa
  50. environment:
  51. GOPATH: "{{ uchiwa_path }}/go"
  52. args:
  53. creates: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa"
  54. notify: Build and deploy Uchiwa
  55. become: true
  56. become_user: "{{ sensu_user_name }}"
  57. - meta: flush_handlers
  58. tags: dashboard
  59. - name: Deploy Uchiwa config
  60. tags: dashboard
  61. template:
  62. src: uchiwa_config.json.j2
  63. dest: "{{ uchiwa_path }}/etc/config.json"
  64. owner: "{{ sensu_user_name }}"
  65. group: "{{ sensu_group_name }}"
  66. notify: restart uchiwa service
  67. - name: Deploy Uchiwa service file
  68. tags: dashboard
  69. template:
  70. src: uchiwa_freebsd.j2
  71. dest: "/usr/local/etc/rc.d/uchiwa"
  72. mode: "0755"
  73. - name: Ensure Uchiwa server service is running
  74. tags: dashboard
  75. service: name=uchiwa state=started enabled=yes