Browse Source

Quoting conditionals & other fixes

cmacrae 10 years ago
parent
commit
8084a4bdfb
9 changed files with 23 additions and 17 deletions
  1. 1 0
      defaults/main.yml
  2. 3 0
      tasks/Ubuntu/main.yml
  3. 5 4
      tasks/client.yml
  4. 2 2
      tasks/dashboard.yml
  5. 2 2
      tasks/main.yml
  6. 2 2
      tasks/rabbit.yml
  7. 2 2
      tasks/redis.yml
  8. 5 4
      tasks/server.yml
  9. 1 1
      tasks/ssl.yml

+ 1 - 0
defaults/main.yml

@@ -28,6 +28,7 @@ sensu_api_uchiwa_path: ''
 sensu_api_timeout: 5000
 sensu_client_config: client.json.j2
 sensu_config_path: /etc/sensu
+sensu_pkg_state: present
 sensu_gem_state: present
 sensu_plugin_gem_state: present
 sensu_group_name: sensu

+ 3 - 0
tasks/Ubuntu/main.yml

@@ -9,3 +9,6 @@
   - 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
+
+  - name: Ensure Sensu is installed
+    apt: name=sensu state={{ sensu_pkg_state }}

+ 5 - 4
tasks/client.yml

@@ -7,6 +7,10 @@
       - "{{ ansible_os_family }}.yml"
       - default.yml
 
+  - 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: Deploy Sensu client RabbitMQ configuration
     template: dest="{{ sensu_config_path }}/conf.d/rabbitmq.json"
               owner={{ sensu_user_name }} group={{ sensu_group_name }}
@@ -20,10 +24,7 @@
     notify: restart sensu-client service
 
   - include: SmartOS/client.yml
-    when: ansible_distribution == SmartOS
-
-  - include: Ubuntu/client.yml
-    when: ansible_distribution == Ubuntu
+    when: ansible_distribution == "SmartOS"
 
   - name: Ensure Sensu client service is running
     service: name=sensu-client state=started enabled=yes

+ 2 - 2
tasks/dashboard.yml

@@ -1,10 +1,10 @@
 ---
 # tasks/dashboard.yml: Deployment of the Uchiwa dashboard
   - include: SmartOS/dashboard.yml
-    when: ansible_distribution == SmartOS
+    when: ansible_distribution == "SmartOS"
 
   - include: Ubuntu/dashboard.yml
-    when: ansible_distribution == Ubuntu
+    when: ansible_distribution == "Ubuntu"
 
   - name: Ensure Uchiwa server service is running
     service: name=uchiwa state=started enabled=yes

+ 2 - 2
tasks/main.yml

@@ -2,10 +2,10 @@
 # tasks/main.yml: "Master" playbook for the cmacrae.sensu role
 
   - include: SmartOS/main.yml tags=setup
-    when: ansible_distribution == SmartOS
+    when: ansible_distribution == "SmartOS"
 
   - include: Ubuntu/main.yml tags=setup
-    when: ansible_distribution == Ubuntu
+    when: ansible_distribution == "Ubuntu"
       
   - include: ssl.yml tags=ssl
 

+ 2 - 2
tasks/rabbit.yml

@@ -8,10 +8,10 @@
       - default.yml
 
   - include: SmartOS/rabbit.yml
-    when: ansible_distribution == SmartOS
+    when: ansible_distribution == "SmartOS"
 
   - include: Ubuntu/rabbit.yml
-    when: ansible_distribution == Ubuntu
+    when: ansible_distribution == "Ubuntu"
 
   - name: Ensure RabbitMQ SSL directory exists
     file: dest={{ rabbitmq_config_path }}/ssl state=directory

+ 2 - 2
tasks/redis.yml

@@ -2,10 +2,10 @@
 # tasks/redis.yml: Deploy Redis
 
   - include: SmartOS/redis.yml
-    when: ansible_distribution == SmartOS
+    when: ansible_distribution == "SmartOS"
 
   - include: Ubuntu/redis.yml
-    when: ansible_distribution == Ubuntu
+    when: ansible_distribution == "Ubuntu"
 
   - name: Ensure Redis is running
     service: name=redis state=started enabled=true

+ 5 - 4
tasks/server.yml

@@ -1,5 +1,9 @@
 ---
 
+  - 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: Deploy Sensu server API configuration
     template: dest={{ sensu_config_path }}/conf.d/api.json
               owner={{ sensu_user_name }} group={{ sensu_group_name }}
@@ -13,10 +17,7 @@
     notify: restart sensu-api service
 
   - include: SmartOS/server.yml
-    when: ansible_distribution == SmartOS
-
-  - include: Ubuntu/server.yml
-    when: ansible_distribution == Ubuntu
+    when: ansible_distribution == "SmartOS"
 
   - name: Ensure Sensu server service is running
     service: name=sensu-server state=started enabled=yes

+ 1 - 1
tasks/ssl.yml

@@ -2,7 +2,7 @@
 # tasks/ssl.yml: Deploy the client SSL cert/key to client systems
 
   - include_vars: "{{ item }}"
-    with_found_first:
+    with_first_found:
       - "{{ ansible_distribution }}.yml"
       - "{{ ansible_os_family }}.yml"
       - default.yml