dashboard.yml 1.7 KB

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