Browse Source

Introducing Ubuntu support!

With this commit, the first re-structure of the role rears its head.
This is the start of support for other major operating systems, starting
with Ubuntu.

Quite literally none of this has even been tested yet - so, wait until
it's merged into master before using.

I'll commence testing soon and weed out any bugs.
After successful testing, documentation will need to be updated, then
I'll begin work on Debian, CentOS will follow shortly after.
cmacrae 10 years ago
parent
commit
b20e8eb678

+ 17 - 2
defaults/main.yml

@@ -1,9 +1,11 @@
 ---
 ---
 
 
 # RabbitMQ server properties
 # RabbitMQ server properties
-rabbitmq_config_path: /opt/local/etc/rabbitmq
+rabbitmq_config_path: /etc/rabbitmq
+rabbitmq_config_template: rabbitmq.config.j2
 rabbitmq_host: "{{ groups['rabbitmq_servers'][0] }}"
 rabbitmq_host: "{{ groups['rabbitmq_servers'][0] }}"
 rabbitmq_port: 5671
 rabbitmq_port: 5671
+rabbitmq_pkg_state: present
 rabbitmq_server: false
 rabbitmq_server: false
 rabbitmq_sensu_user_name: sensu
 rabbitmq_sensu_user_name: sensu
 rabbitmq_sensu_password: sensu
 rabbitmq_sensu_password: sensu
@@ -12,6 +14,8 @@ rabbitmq_sensu_vhost: /sensu
 # Redis server properties
 # Redis server properties
 redis_host: "{{ groups['redis_servers'][0] }}"
 redis_host: "{{ groups['redis_servers'][0] }}"
 redis_server: false
 redis_server: false
+redis_pkg_repo: ~
+redis_pkg_state: present
 redis_port: 6379
 redis_port: 6379
 
 
 # Sensu/Uchiwa user/group/service properties
 # Sensu/Uchiwa user/group/service properties
@@ -23,7 +27,7 @@ sensu_api_password: secret
 sensu_api_uchiwa_path: ''
 sensu_api_uchiwa_path: ''
 sensu_api_timeout: 5000
 sensu_api_timeout: 5000
 sensu_client_config: client.json.j2
 sensu_client_config: client.json.j2
-sensu_config_path: /opt/local/etc/sensu
+sensu_config_path: /etc/sensu
 sensu_gem_state: present
 sensu_gem_state: present
 sensu_plugin_gem_state: present
 sensu_plugin_gem_state: present
 sensu_group_name: sensu
 sensu_group_name: sensu
@@ -32,6 +36,14 @@ sensu_include_dashboard: false
 sensu_master: false
 sensu_master: false
 sensu_user_name: sensu
 sensu_user_name: sensu
 
 
+# Sensu/RabbitMQ SSL certificate properties
+sensu_ssl_gen_certs: true
+sensu_ssl_client_cert: "{{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/client/cert.pem"
+sensu_ssl_client_key: "{{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/client/key.pem"
+sensu_ssl_server_cacert: "{{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/sensu_ca/cacert.pem"
+sensu_ssl_server_cert: "{{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/server/cert.pem"
+sensu_ssl_server_key: "{{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/server/key.pem"
+  
 # Uchiwa properties
 # Uchiwa properties
 uchiwa_dc_name: ~
 uchiwa_dc_name: ~
 uchiwa_path: /opt/uchiwa
 uchiwa_path: /opt/uchiwa
@@ -40,3 +52,6 @@ uchiwa_user_name: admin
 uchiwa_password: admin
 uchiwa_password: admin
 uchiwa_port: 3000
 uchiwa_port: 3000
 uchiwa_refresh: 5
 uchiwa_refresh: 5
+uchiwa_pkg_download_md5: ~
+uchiwa_pkg_download_path: ~
+uchiwa_pkg_download_url: ~

+ 15 - 0
files/ubuntu_redis_systemd.service

@@ -0,0 +1,15 @@
+[Unit]
+Description=Redis Datastore Server
+After=network.target
+
+[Service]
+Type=forking
+PIDFile=/var/run/redis/redis.pid
+ExecStartPre=/bin/mkdir -p /var/run/redis
+ExecStartPre=/bin/chown redis:redis /var/run/redis
+
+ExecStart=/sbin/start-stop-daemon --start --chuid redis:redis --pidfile /var/run/redis/redis.pid --umask 007 --exec /usr/bin/redis-server -- /etc/redis/redis.conf
+ExecReload=/bin/kill -USR2 $MAINPID
+
+[Install]
+WantedBy=multi-user.target

+ 1 - 1
handlers/main.yml

@@ -15,6 +15,7 @@
   - name: restart sensu-client service
   - name: restart sensu-client service
     service: name=sensu-client state=restarted
     service: name=sensu-client state=restarted
 
 
+  # Joyent SmartOS specific handlers
   - name: import sensu-server service
   - name: import sensu-server service
     command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/sensu-server.xml
     command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/sensu-server.xml
   
   
@@ -26,4 +27,3 @@
   
   
   - name: import uchiwa service
   - name: import uchiwa service
     command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/uchiwa.xml
     command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/uchiwa.xml
-  

+ 20 - 0
tasks/SmartOS/client.yml

@@ -0,0 +1,20 @@
+---
+# tasks/client.yml: Deploy various client-side configurations for Sensu
+# Specific to Joyent SmartOS
+  
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+      - "{{ ansible_os_family }}.yml"
+      - default.yml
+
+  - name: Deploy Sensu client service manifest
+    template: dest=/opt/local/lib/svc/manifest/sensu-client.xml
+              src=sensu-client.smartos_smf_manifest.xml.j2
+              owner=root group=root mode=644
+    notify: import sensu-client service
+              
+  - name: Initial import of Sensu client service
+    command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/sensu-client.xml
+    args:
+      creates: "/var/svc/log/application-sensu-client:default.log"

+ 72 - 0
tasks/SmartOS/dashboard.yml

@@ -0,0 +1,72 @@
+---
+# tasks/SmartOS/dashboard.yml: Deployment of the Uchiwa dashboard
+# Specific to Joyent SmartOS
+
+  - name: Ensure Uchiwa (dashboard) dependencies are installed
+    pkgin: name=go state=present
+
+  - name: Ensure Uchiwa directory exists
+    file: dest={{ uchiwa_path }} state=directory
+          owner={{ sensu_user_name }} group={{ sensu_group_name }}
+          recurse=yes
+
+  - 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 GOPATH exists
+    file: dest={{ uchiwa_path }}/go/{{ item }}
+          owner={{ sensu_user_name }}
+          group={{ sensu_group_name }}
+          state=directory recurse=yes
+    with_items:
+      - bin
+      - pkg
+      - 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"
+
+  - 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 }}"
+
+  - name: Deploy Uchiwa config
+    template: src=uchiwa_config.json.j2 dest={{ uchiwa_path }}/etc/config.json
+              owner={{ sensu_user_name }} group={{ sensu_group_name }}
+    notify: restart uchiwa service
+
+  - name: Deploy Uchiwa service script
+    template: src=uchiwa.sh.j2
+              dest=/opt/local/lib/svc/method/uchiwa
+              owner=root group=root mode=755
+    notify: restart uchiwa service
+
+  - name: Deploy Uchiwa service manifest
+    template: dest=/opt/local/lib/svc/manifest/uchiwa.xml
+              src=uchiwa.smartos_smf_manifest.xml.j2
+              owner=root group=root mode=644
+    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"
+
+  - name: Ensure Uchiwa server service is running
+    service: name=uchiwa state=started enabled=yes

+ 36 - 0
tasks/SmartOS/main.yml

@@ -0,0 +1,36 @@
+---
+# tasks/SmartOS/main.yml: "Set-up" playbook for cmacrae.sensu role
+# This takes care of base prerequisites for Joyent SmartOS
+
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+      - "{{ ansible_os_family }}.yml"
+      - default.yml
+
+  - name: Ensure the Sensu group is present
+    group: name={{ sensu_group_name }}
+             state=present
+             
+  - name: Ensure the Sensu user is present
+    user: name={{ sensu_user_name }}
+          group={{ sensu_group_name }}
+          shell=/bin/false
+          home={{ sensu_config_path }}
+          createhome=yes
+          state=present
+
+  - name: Ensure the Sensu config directory is present
+    file: dest={{ sensu_config_path }}/conf.d state=directory recurse=yes
+          owner={{ sensu_user_name }} group={{ sensu_group_name }}
+
+  - name: Ensure Sensu dependencies are installed
+    pkgin: name=build-essential,ruby21-base state=present
+
+  - name: Ensure Sensu is installed
+    gem: name=sensu state={{ sensu_gem_state }} user_install=no
+    notify:
+      - restart sensu-client service
+    
+  - name: Ensure Sensu 'plugins' gem is installed
+    gem: name=sensu-plugin state={{ sensu_plugin_gem_state }} user_install=no

+ 6 - 0
tasks/SmartOS/rabbit.yml

@@ -0,0 +1,6 @@
+---
+# tasks/SmartOS/rabbit.yml: Deploy RabbitMQ
+# Specific to Joyent SmartOS
+
+- name: Ensure RabbitMQ is installed
+  pkgin: name=rabbitmq state=present

+ 12 - 0
tasks/SmartOS/redis.yml

@@ -0,0 +1,12 @@
+---
+# tasks/SmartOS/redis.yml: Deploy Redis
+# Specific to Ubuntu
+
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+      - "{{ ansible_os_family }}.yml"
+      - default.yml
+
+  - name: Ensure Redis is installed
+    pkgin: name=redis state={{ redis_pkg_state }}

+ 26 - 0
tasks/SmartOS/server.yml

@@ -0,0 +1,26 @@
+---
+# tasks/SmartOS/server.yml: Deploy the necessary configuration for
+# a Sensu 'master' node.
+# Specific to SmartOS
+
+  - name: Deploy Sensu server service manifest
+    template: dest=/opt/local/lib/svc/manifest/sensu-server.xml
+              src=sensu-server.smartos_smf_manifest.xml.j2
+              owner=root group=root mode=644
+    notify: import sensu-server service
+
+  - name: Deploy Sensu API service manifest
+    template: dest=/opt/local/lib/svc/manifest/sensu-api.xml
+              src=sensu-api.smartos_smf_manifest.xml.j2
+              owner=root group=root mode=644
+    notify: import sensu-api service
+ 
+  - name: Initial import of Sensu server service
+    command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/sensu-server.xml
+    args:
+      creates: "/var/svc/log/application-sensu-server:default.log"
+        
+  - name: Initial import of Sensu API service
+    command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/sensu-api.xml
+    args:
+      creates: "/var/svc/log/application-sensu-api:default.log"

+ 17 - 0
tasks/Ubuntu/dashboard.yml

@@ -0,0 +1,17 @@
+---
+# tasks/Ubuntu/dashboard.yml: Deployment of the Uchiwa dashboard
+# Specific to Ubuntu
+
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+      - "{{ ansible_os_family }}.yml"
+      - default.yml
+
+  - name: Retrieve the Uchiwa deb package
+    get_url: url={{ uchiwa_pkg_download_url }}
+             dest={{ uchiwa_pkg_download_path }}
+             checksum=md5:{{ uchiwa_pkg_download_md5 }}
+
+  - name: Install Uchiwa from the retrieved deb package
+    apt: deb={{ uchiwa_pkg_download_path }} 

+ 11 - 0
tasks/Ubuntu/main.yml

@@ -0,0 +1,11 @@
+---
+# tasks/Ubuntu/main.yml: Ubuntu specific set-up
+# This takes care of base prerequisites for Ubuntu
+
+  - name: Ensure the Sensu APT repo GPG key is present
+    apt_key: url=http://repositories.sensuapp.org/apt/pubkey.gpg
+             state=present
+
+  - name: Ensure the Sensu Core APT repo is present
+    apt_repository: repo='deb     http://repositories.sensuapp.org/apt sensu main'
+                    state=present update_cache=yes

+ 21 - 0
tasks/Ubuntu/rabbit.yml

@@ -0,0 +1,21 @@
+---
+# tasks/Ubuntu/rabbit.yml: Deploy RabbitMQ
+# Specific to Ubuntu
+
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+      - "{{ ansible_os_family }}.yml"
+      - default.yml
+
+  - name: Ensure the RabbitMQ APT repo GPG key is present
+    apt_key: url=https://www.rabbitmq.com/rabbitmq-signing-key-public.asc
+             state=present
+
+  - name: Ensure the RabbitMQ APT repo is present
+    apt_repository: repo='deb http://www.rabbitmq.com/debian/ testing main'
+                    state=present update_cache=yes
+
+  - name: Ensure RabbitMQ is installed
+    apt: name=rabbitmq state={{ rabbitmq_pkg_state }}
+         update_cache=yes

+ 21 - 0
tasks/Ubuntu/redis.yml

@@ -0,0 +1,21 @@
+---
+# tasks/Ubuntu/redis.yml: Deploy Redis
+# Specific to Ubuntu
+
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+      - "{{ ansible_os_family }}.yml"
+      - default.yml
+
+  - name: Ensure the Redis APT repo is present
+    apt_repository: repo={{ redis_pkg_repo }}
+                    state=present update_cache=yes
+
+  - name: Ensure Redis is installed
+    apt: name=redis-server state={{ redis_pkg_state }}
+         update_cache=yes
+
+  - name: Deploy Redis systemd service manifest
+    copy: src=ubuntu_redis_systemd.service
+          dest=/etc/systemd/system/redis-server.service

+ 11 - 10
tasks/client.yml

@@ -1,4 +1,11 @@
 ---
 ---
+# tasks/client.yml: Deploy various client-side configurations for Sensu
+  
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+      - "{{ ansible_os_family }}.yml"
+      - default.yml
 
 
   - name: Deploy Sensu client RabbitMQ configuration
   - name: Deploy Sensu client RabbitMQ configuration
     template: dest="{{ sensu_config_path }}/conf.d/rabbitmq.json"
     template: dest="{{ sensu_config_path }}/conf.d/rabbitmq.json"
@@ -12,16 +19,10 @@
               src={{ sensu_client_config  }}
               src={{ sensu_client_config  }}
     notify: restart sensu-client service
     notify: restart sensu-client service
 
 
-  - name: Deploy Sensu client service manifest
-    template: dest=/opt/local/lib/svc/manifest/sensu-client.xml
-              src=sensu-client.smartos_smf_manifest.xml.j2
-              owner=root group=root mode=644
-    notify: import sensu-client service
-              
-  - name: Initial import of Sensu client service
-    command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/sensu-client.xml
-    args:
-      creates: "/var/svc/log/application-sensu-client:default.log"
+  - include: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}/client.yml"
+      - "{{ ansible_os_family }}/client.yml"
 
 
   - name: Ensure Sensu client service is running
   - name: Ensure Sensu client service is running
     service: name=sensu-client state=started enabled=yes
     service: name=sensu-client state=started enabled=yes

+ 5 - 63
tasks/dashboard.yml

@@ -1,67 +1,9 @@
 ---
 ---
-
-  - name: Ensure Uchiwa directory exists
-    file: dest={{ uchiwa_path }} state=directory
-          owner={{ sensu_user_name }} group={{ sensu_group_name }}
-          recurse=yes
-
-  - 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 GOPATH exists
-    file: dest={{ uchiwa_path }}/go/{{ item }}
-          owner={{ sensu_user_name }}
-          group={{ sensu_group_name }}
-          state=directory recurse=yes
-    with_items:
-      - bin
-      - pkg
-      - 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"
-
-  - 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 }}"
-
-  - name: Deploy Uchiwa config
-    template: src=uchiwa_config.json.j2 dest={{ uchiwa_path }}/etc/config.json
-              owner={{ sensu_user_name }} group={{ sensu_group_name }}
-    notify: restart uchiwa service
-
-  - name: Deploy Uchiwa service script
-    template: src=uchiwa.sh.j2
-              dest=/opt/local/lib/svc/method/uchiwa
-              owner=root group=root mode=755
-    notify: restart uchiwa service
-
-  - name: Deploy Uchiwa service manifest
-    template: dest=/opt/local/lib/svc/manifest/uchiwa.xml
-              src=uchiwa.smartos_smf_manifest.xml.j2
-              owner=root group=root mode=644
-    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"
+# tasks/dashboard.yml: Deployment of the Uchiwa dashboard
+  - include: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}/dashboard.yml"
+      - "{{ ansible_os_family }}/dashboard.yml"
 
 
   - 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

+ 6 - 31
tasks/main.yml

@@ -1,36 +1,11 @@
 ---
 ---
+# tasks/main.yml: "Master" playbook for the cmacrae.sensu role
 
 
-  - name: Ensure the Sensu group is present
-    group: name={{ sensu_group_name }}
-             state=present
-             
-  - name: Ensure the Sensu user is present
-    user: name={{ sensu_user_name }}
-          group={{ sensu_group_name }}
-          shell=/bin/false
-          home={{ sensu_config_path }}
-          createhome=yes
-          state=present
-
-  - name: Ensure the Sensu config directory is present
-    file: dest={{ sensu_config_path }}/conf.d state=directory recurse=yes
-          owner={{ sensu_user_name }} group={{ sensu_group_name }}
-
-  - name: Ensure Sensu dependencies are installed
-    pkgin: name=build-essential,ruby21-base state=present
-
-  - name: Ensure Uchiwa (dashboard) dependencies are installed
-    pkgin: name=go state=present
-    when: sensu_include_dashboard
-
-  - name: Ensure Sensu is installed
-    gem: name=sensu state={{ sensu_gem_state }} user_install=no
-    notify:
-      - restart sensu-client service
-    
-  - name: Ensure Sensu 'plugins' gem is installed
-    gem: name=sensu-plugin state={{ sensu_plugin_gem_state }} user_install=no
-
+  - include: "{{ item }} tags=setup"
+    with_first_found:
+      - "{{ ansible_distribution }}/main.yml"
+      - "{{ ansible_os_family }}/main.yml"
+      
   - include: ssl.yml tags=ssl
   - include: ssl.yml tags=ssl
 
 
   - include: rabbit.yml tags=rabbitmq
   - include: rabbit.yml tags=rabbitmq

+ 7 - 9
tasks/plugins.yml

@@ -1,4 +1,11 @@
 ---
 ---
+# tasks/plugins.yml: Deploy available checks/plugins/handlers/filters/mutators
+
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+      - "{{ ansible_os_family }}.yml"
+      - default.yml
 
 
   - name: Ensure Sensu plugin directory exists
   - name: Ensure Sensu plugin directory exists
     file: dest={{ sensu_config_path }}/plugins state=directory
     file: dest={{ sensu_config_path }}/plugins state=directory
@@ -35,12 +42,3 @@
           dest={{ sensu_config_path }}/plugins/ mode=755
           dest={{ sensu_config_path }}/plugins/ mode=755
           owner={{ sensu_user_name }} group={{ sensu_group_name }}
           owner={{ sensu_user_name }} group={{ sensu_group_name }}
     notify: restart sensu-client service
     notify: restart sensu-client service
-
-  - name: Deploy check/handler/filter/mutator definitions to the master
-    template: src={{ static_data_store }}/sensu/definitions/{{ item }}.j2
-          dest={{ sensu_config_path }}/conf.d/{{ item }}
-          owner={{ sensu_user_name }} group={{ sensu_group_name }}
-    when: sensu_master
-    with_lines:
-      - ls {{ static_data_store }}/sensu/definitions | cut -d. --fields=1,2
-    notify: restart sensu-api service

+ 16 - 7
tasks/rabbit.yml

@@ -1,22 +1,31 @@
 ---
 ---
+# tasks/rabbit.yml: Deploy RabbitMQ and set-up vhost for Sensu messaging
 
 
-  - name: Ensure RabbitMQ is installed
-    pkgin: name=rabbitmq state=present
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+      - "{{ ansible_os_family }}.yml"
+      - default.yml
+
+  - include: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}/rabbit.yml"
+      - "{{ ansible_os_family }}/rabbit.yml"
 
 
   - name: Ensure RabbitMQ SSL directory exists
   - name: Ensure RabbitMQ SSL directory exists
     file: dest={{ rabbitmq_config_path }}/ssl state=directory
     file: dest={{ rabbitmq_config_path }}/ssl state=directory
 
 
   - name: Ensure RabbitMQ SSL certs/keys are in place
   - name: Ensure RabbitMQ SSL certs/keys are in place
-    copy: src={{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/{{ item }}
+    copy: src={{ item }}
           dest={{ rabbitmq_config_path }}/ssl
           dest={{ rabbitmq_config_path }}/ssl
     with_items:
     with_items:
-      - sensu_ca/cacert.pem
-      - server/cert.pem
-      - server/key.pem
+      - "{{ sensu_ssl_server_cacert }}"
+      - "{{ sensu_ssl_server_cert }}"
+      - "{{ sensu_ssl_server_key }}"
 
 
   - name: Deploy RabbitMQ config
   - name: Deploy RabbitMQ config
     template: dest={{ rabbitmq_config_path }}/rabbitmq.config
     template: dest={{ rabbitmq_config_path }}/rabbitmq.config
-              src=rabbitmq.config.j2
+              src={{ rabbitmq_config_template }}
               owner=root group=root mode=644
               owner=root group=root mode=644
     notify: restart rabbitmq service
     notify: restart rabbitmq service
 
 

+ 5 - 2
tasks/redis.yml

@@ -1,7 +1,10 @@
 ---
 ---
+# tasks/redis.yml: Deploy Redis
 
 
-  - name: Ensure Redis is installed
-    pkgin: name=redis state=present
+  - include: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}/redis.yml"
+      - "{{ ansible_os_family }}/redis.yml"
 
 
   - name: Ensure Redis is running
   - name: Ensure Redis is running
     service: name=redis state=started enabled=true
     service: name=redis state=started enabled=true

+ 4 - 21
tasks/server.yml

@@ -12,27 +12,10 @@
               src=sensu-redis.json.j2
               src=sensu-redis.json.j2
     notify: restart sensu-api service
     notify: restart sensu-api service
 
 
-  - name: Deploy Sensu server service manifest
-    template: dest=/opt/local/lib/svc/manifest/sensu-server.xml
-              src=sensu-server.smartos_smf_manifest.xml.j2
-              owner=root group=root mode=644
-    notify: import sensu-server service
-
-  - name: Deploy Sensu API service manifest
-    template: dest=/opt/local/lib/svc/manifest/sensu-api.xml
-              src=sensu-api.smartos_smf_manifest.xml.j2
-              owner=root group=root mode=644
-    notify: import sensu-api service
- 
-  - name: Initial import of Sensu server service
-    command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/sensu-server.xml
-    args:
-      creates: "/var/svc/log/application-sensu-server:default.log"
-        
-  - name: Initial import of Sensu API service
-    command: /usr/sbin/svccfg import /opt/local/lib/svc/manifest/sensu-api.xml
-    args:
-      creates: "/var/svc/log/application-sensu-api:default.log"
+  - include: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}/server.yml"
+      - "{{ ansible_os_family }}/server.yml"
 
 
   - name: Ensure Sensu server service is running
   - name: Ensure Sensu server service is running
     service: name=sensu-server state=started enabled=yes
     service: name=sensu-server state=started enabled=yes

+ 11 - 44
tasks/ssl.yml

@@ -1,52 +1,19 @@
 ---
 ---
+# tasks/ssl.yml: Deploy the client SSL cert/key to client systems
 
 
-  - name: Ensure Sensu SSL directory exists
-    file: dest={{ sensu_config_path }}/ssl state=directory
-          owner={{ sensu_user_name }} group={{ sensu_group_name }}
-
-  - name: Ensure SSL generation directory exists
-    file: dest={{ sensu_config_path }}/ssl_generation state=directory
-          owner={{ sensu_user_name }} group={{ sensu_group_name }}
-    when: sensu_master
-
-  - name: Fetch the ssl_certs tarball from sensuapp.org
-    get_url: url=http://sensuapp.org/docs/0.16/tools/ssl_certs.tar
-             dest={{ sensu_config_path }}/ssl_generation/ssl_certs.tar
-    when: sensu_master
-    sudo: yes
-    sudo_user: "{{ sensu_user_name }}"
+  - include_vars: "{{ item }}"
+    with_found_first:
+      - "{{ ansible_distribution }}.yml"
+      - "{{ ansible_os_family }}.yml"
+      - default.yml
 
 
-  - name: Untar the ssl_certs tarball from sensuapp.org
-    shell: tar xf ssl_certs.tar chdir={{ sensu_config_path }}/ssl_generation
-    args:
-      creates: "{{ sensu_config_path }}/ssl_generation/ssl_certs"
-    when: sensu_master
-    sudo: yes
-    sudo_user: "{{ sensu_user_name }}"
-
-  - name: Generate SSL certs
-    shell: ./ssl_certs.sh generate chdir={{ sensu_config_path }}/ssl_generation/ssl_certs
-    args:
-      creates: "{{ sensu_config_path }}/ssl_generation/ssl_certs/server"
-    when: sensu_master
-    sudo: yes
-    sudo_user: "{{ sensu_user_name }}"
-
-  - name: Stash the Sensu SSL certs/keys
-    fetch: src={{ sensu_config_path }}/ssl_generation/ssl_certs/{{ item }}
-           dest={{ dynamic_data_store }}
-    when: sensu_master
-    with_items:
-      - sensu_ca/cacert.pem
-      - server/cert.pem
-      - server/key.pem
-      - client/cert.pem
-      - client/key.pem
+  - include: ssl_generate.yml
+    when: sensu_ssl_gen_certs
 
 
   - name: Deploy the Sensu client SSL cert/key
   - name: Deploy the Sensu client SSL cert/key
-    copy: src={{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/client/{{ item }}
+    copy: src={{ item }}
           owner={{ sensu_user_name }} group={{ sensu_group_name }}
           owner={{ sensu_user_name }} group={{ sensu_group_name }}
           dest={{ sensu_config_path }}/ssl
           dest={{ sensu_config_path }}/ssl
     with_items:
     with_items:
-      - cert.pem
-      - key.pem
+      - "{{ sensu_ssl_client_cert }}"
+      - "{{ sensu_ssl_client_key }}"

+ 46 - 0
tasks/ssl_generate.yml

@@ -0,0 +1,46 @@
+---
+# tasks/ssl_generate.yml: Generate SSL data and stash to dynamic
+# data store for deployment to clients
+
+  - name: Ensure Sensu SSL directory exists
+    file: dest={{ sensu_config_path }}/ssl state=directory
+          owner={{ sensu_user_name }} group={{ sensu_group_name }}
+
+  - name: Ensure SSL generation directory exists
+    file: dest={{ sensu_config_path }}/ssl_generation state=directory
+          owner={{ sensu_user_name }} group={{ sensu_group_name }}
+    when: sensu_master
+
+  - name: Fetch the ssl_certs tarball from sensuapp.org
+    get_url: url=wget http://sensuapp.org/docs/0.20/files/sensu_ssl_tool.tar
+             dest={{ sensu_config_path }}/ssl_generation/ssl_certs.tar
+    when: sensu_master
+    sudo: yes
+    sudo_user: "{{ sensu_user_name }}"
+
+  - name: Untar the ssl_certs tarball from sensuapp.org
+    shell: tar xf ssl_certs.tar chdir={{ sensu_config_path }}/ssl_generation
+    args:
+      creates: "{{ sensu_config_path }}/ssl_generation/ssl_certs"
+    when: sensu_master
+    sudo: yes
+    sudo_user: "{{ sensu_user_name }}"
+
+  - name: Generate SSL certs
+    shell: ./ssl_certs.sh generate chdir={{ sensu_config_path }}/ssl_generation/ssl_certs
+    args:
+      creates: "{{ sensu_config_path }}/ssl_generation/ssl_certs/server"
+    when: sensu_master
+    sudo: yes
+    sudo_user: "{{ sensu_user_name }}"
+
+  - name: Stash the Sensu SSL certs/keys
+    fetch: src={{ sensu_config_path }}/ssl_generation/ssl_certs/{{ item }}
+           dest={{ dynamic_data_store }}
+    when: sensu_master
+    with_items:
+      - sensu_ca/cacert.pem
+      - server/cert.pem
+      - server/key.pem
+      - client/cert.pem
+      - client/key.pem

+ 9 - 0
vars/SmartOS.yml

@@ -0,0 +1,9 @@
+---
+# vars/SmartOS.yml: Variables for Joyent SmartOS
+# Defaults are defined in vars/default.yml
+
+# RabbitMQ server properties
+rabbitmq_config_path: /opt/local/etc/rabbitmq
+
+# Sensu/Uchiwa user/group/service properties
+sensu_config_path: /opt/local/etc/sensu

+ 13 - 0
vars/Ubuntu.yml

@@ -0,0 +1,13 @@
+---
+# vars/Ubuntu.yml: Variables for Ubuntu
+# Defaults are defined in vars/default.yml
+
+# Redis server properties
+redis_pkg_repo: 'ppa:rwky/redis'
+
+# Sensu/Uchiwa user/group/service properties
+sensu_user_name: root
+sensu_group_name: root
+uchiwa_pkg_download_md5: e8f2c4f12cf47e4e587947a2535c2458
+uchiwa_pkg_download_path: /root/uchiwa_latest.deb
+uchiwa_pkg_download_url: http://dl.bintray.com/palourde/uchiwa/uchiwa_0.12.1-1_amd64.deb

+ 57 - 0
vars/default.yml

@@ -0,0 +1,57 @@
+---
+
+# RabbitMQ server properties
+rabbitmq_config_path: /etc/rabbitmq
+rabbitmq_config_template: rabbitmq.config.j2
+rabbitmq_host: "{{ groups['rabbitmq_servers'][0] }}"
+rabbitmq_port: 5671
+rabbitmq_pkg_state: present
+rabbitmq_server: false
+rabbitmq_sensu_user_name: sensu
+rabbitmq_sensu_password: sensu
+rabbitmq_sensu_vhost: /sensu
+
+# Redis server properties
+redis_host: "{{ groups['redis_servers'][0] }}"
+redis_server: false
+redis_pkg_repo: ~
+redis_pkg_state: present
+redis_port: 6379
+
+# Sensu/Uchiwa user/group/service properties
+sensu_api_host: "{{ groups['sensu_masters'][0] }}"
+sensu_api_port: 4567
+sensu_api_ssl: "false"
+sensu_api_user_name: admin
+sensu_api_password: secret
+sensu_api_uchiwa_path: ''
+sensu_api_timeout: 5000
+sensu_client_config: client.json.j2
+sensu_config_path: /etc/sensu
+sensu_gem_state: present
+sensu_plugin_gem_state: present
+sensu_group_name: sensu
+sensu_include_plugins: true
+sensu_include_dashboard: false
+sensu_master: false
+sensu_user_name: sensu
+
+# Sensu/RabbitMQ SSL certificate properties
+sensu_ssl_gen_certs: true
+sensu_ssl_client_cert: "{{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/client/cert.pem"
+sensu_ssl_client_key: "{{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/client/key.pem"
+sensu_ssl_server_cacert: "{{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/sensu_ca/cacert.pem"
+sensu_ssl_server_cert: "{{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/server/cert.pem"
+sensu_ssl_server_key: "{{ dynamic_data_store }}/{{ groups['sensu_masters'][0] }}/{{ sensu_config_path }}/ssl_generation/ssl_certs/server/key.pem"
+  
+# Uchiwa properties
+uchiwa_dc_name: ~
+uchiwa_path: /opt/uchiwa
+uchiwa_redis_use_ssl: false
+uchiwa_user_name: admin
+uchiwa_password: admin
+uchiwa_port: 3000
+uchiwa_refresh: 5
+uchiwa_pkg_download_md5: ~
+uchiwa_pkg_download_path: ~
+uchiwa_pkg_download_url: ~