|
@@ -8,67 +8,81 @@
|
|
|
pkgin: name=go state=present
|
|
pkgin: name=go state=present
|
|
|
|
|
|
|
|
- name: Ensure Uchiwa directory exists
|
|
- name: Ensure Uchiwa directory exists
|
|
|
- file: dest={{ uchiwa_path }} state=directory
|
|
|
|
|
- owner={{ sensu_user_name }} group={{ sensu_group_name }}
|
|
|
|
|
- recurse=yes
|
|
|
|
|
|
|
+ file:
|
|
|
|
|
+ dest: "{{ uchiwa_path }}"
|
|
|
|
|
+ state: directory
|
|
|
|
|
+ owner: "{{ sensu_user_name }}"
|
|
|
|
|
+ group: "{{ sensu_group_name }}"
|
|
|
|
|
+ recurse: true
|
|
|
|
|
|
|
|
- - name: Ensure Uchiwa config directory exists
|
|
|
|
|
- file: dest={{ uchiwa_path }}/etc state=directory
|
|
|
|
|
- owner={{ sensu_user_name }} group={{ sensu_group_name }}
|
|
|
|
|
- recurse=yes
|
|
|
|
|
-
|
|
|
|
|
- - name: Ensure Uchiwa Go directory exists
|
|
|
|
|
- file: dest={{ uchiwa_path }}/go state=directory
|
|
|
|
|
- owner={{ sensu_user_name }} group={{ sensu_group_name }}
|
|
|
|
|
- recurse=yes
|
|
|
|
|
|
|
+ - name: Ensure Uchiwa Go/config directory exists
|
|
|
|
|
+ file:
|
|
|
|
|
+ dest: "{{ uchiwa_path }}/{{ item }}"
|
|
|
|
|
+ state: directory
|
|
|
|
|
+ owner: "{{ sensu_user_name }}"
|
|
|
|
|
+ group: "{{ sensu_group_name }}"
|
|
|
|
|
+ recurse: true
|
|
|
|
|
+ with_items:
|
|
|
|
|
+ - etc
|
|
|
|
|
+ - go
|
|
|
|
|
|
|
|
- name: Ensure Uchiwa GOPATH exists
|
|
- name: Ensure Uchiwa GOPATH exists
|
|
|
- file: dest={{ uchiwa_path }}/go/{{ item }}
|
|
|
|
|
- owner={{ sensu_user_name }}
|
|
|
|
|
- group={{ sensu_group_name }}
|
|
|
|
|
- state=directory recurse=yes
|
|
|
|
|
|
|
+ file:
|
|
|
|
|
+ dest: "{{ uchiwa_path }}/go/{{ item }}"
|
|
|
|
|
+ owner: "{{ sensu_user_name }}"
|
|
|
|
|
+ group: "{{ sensu_group_name }}"
|
|
|
|
|
+ state: directory
|
|
|
|
|
+ recurse: true
|
|
|
with_items:
|
|
with_items:
|
|
|
- bin
|
|
- bin
|
|
|
- pkg
|
|
- pkg
|
|
|
- src
|
|
- src
|
|
|
|
|
|
|
|
- - name: Fetch Uchiwa from GitHub
|
|
|
|
|
- command: go get github.com/sensu/uchiwa
|
|
|
|
|
- environment:
|
|
|
|
|
- GOPATH: "{{ uchiwa_path }}/go"
|
|
|
|
|
- sudo: yes
|
|
|
|
|
- sudo_user: "{{ sensu_user_name }}"
|
|
|
|
|
- args:
|
|
|
|
|
- creates: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa"
|
|
|
|
|
|
|
+ - block:
|
|
|
|
|
+
|
|
|
|
|
+ - name: Fetch Uchiwa from GitHub
|
|
|
|
|
+ command: go get github.com/sensu/uchiwa
|
|
|
|
|
+ environment:
|
|
|
|
|
+ GOPATH: "{{ uchiwa_path }}/go"
|
|
|
|
|
+ args:
|
|
|
|
|
+ creates: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa"
|
|
|
|
|
+
|
|
|
|
|
+ - name: Build and deploy Uchiwa
|
|
|
|
|
+ shell: npm install --production
|
|
|
|
|
+ args:
|
|
|
|
|
+ chdir: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa"
|
|
|
|
|
+ creates: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa/public/bower_components"
|
|
|
|
|
|
|
|
- - name: Build and deploy Uchiwa
|
|
|
|
|
- shell: npm install --production chdir={{ uchiwa_path }}/go/src/github.com/sensu/uchiwa
|
|
|
|
|
- args:
|
|
|
|
|
- creates: "{{ uchiwa_path }}/go/src/github.com/sensu/uchiwa/public/bower_components"
|
|
|
|
|
- sudo: yes
|
|
|
|
|
- sudo_user: "{{ sensu_user_name }}"
|
|
|
|
|
|
|
+ become: true
|
|
|
|
|
+ become_user: "{{ sensu_user_name }}"
|
|
|
|
|
|
|
|
- name: Deploy Uchiwa config
|
|
- name: Deploy Uchiwa config
|
|
|
- template: src=../../templates/uchiwa_config.json.j2 dest={{ uchiwa_path }}/etc/config.json
|
|
|
|
|
- owner={{ sensu_user_name }} group={{ sensu_group_name }}
|
|
|
|
|
|
|
+ template:
|
|
|
|
|
+ src: '../../templates/uchiwa_config.json.j2'
|
|
|
|
|
+ dest: "{{ uchiwa_path }}/etc/config.json"
|
|
|
|
|
+ owner: "{{ sensu_user_name }}"
|
|
|
|
|
+ group: "{{ sensu_group_name }}"
|
|
|
notify: restart uchiwa service
|
|
notify: restart uchiwa service
|
|
|
|
|
|
|
|
- name: Deploy Uchiwa service script
|
|
- name: Deploy Uchiwa service script
|
|
|
- template: src=../../templates/uchiwa.sh.j2
|
|
|
|
|
- dest=/opt/local/lib/svc/method/uchiwa
|
|
|
|
|
- owner=root group=root mode=755
|
|
|
|
|
|
|
+ template:
|
|
|
|
|
+ src: '../../templates/uchiwa.sh.j2'
|
|
|
|
|
+ dest: /opt/local/lib/svc/method/uchiwa
|
|
|
|
|
+ owner: root
|
|
|
|
|
+ group: root
|
|
|
|
|
+ mode: 755
|
|
|
notify: restart uchiwa service
|
|
notify: restart uchiwa service
|
|
|
|
|
|
|
|
- name: Deploy Uchiwa service manifest
|
|
- name: Deploy Uchiwa service manifest
|
|
|
- template: dest=/opt/local/lib/svc/manifest/uchiwa.xml
|
|
|
|
|
- src=../../templates/uchiwa.smartos_smf_manifest.xml.j2
|
|
|
|
|
- owner=root group=root mode=644
|
|
|
|
|
|
|
+ template:
|
|
|
|
|
+ dest: /opt/local/lib/svc/manifest/uchiwa.xml
|
|
|
|
|
+ src: '../../templates/uchiwa.smartos_smf_manifest.xml.j2'
|
|
|
|
|
+ owner: root
|
|
|
|
|
+ group: root
|
|
|
|
|
+ mode: 644
|
|
|
notify: import uchiwa service
|
|
notify: import uchiwa service
|
|
|
|
|
|
|
|
- - name: Initial import of Uchiwa server service
|
|
|
|
|
- command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/uchiwa.xml
|
|
|
|
|
- args:
|
|
|
|
|
- creates: "/var/svc/log/application-uchiwa:default.log"
|
|
|
|
|
|
|
+ - meta: flush_handlers
|
|
|
|
|
|
|
|
- name: Ensure Uchiwa server service is running
|
|
- name: Ensure Uchiwa server service is running
|
|
|
service: name=uchiwa state=started enabled=yes
|
|
service: name=uchiwa state=started enabled=yes
|