dashboard.yml 1.9 KB

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