浏览代码

Cleaner approach to include logic...

cmacrae 10 年之前
父节点
当前提交
26592ef85b
共有 6 个文件被更改,包括 6 次插入30 次删除
  1. 1 5
      tasks/client.yml
  2. 1 5
      tasks/dashboard.yml
  3. 1 5
      tasks/main.yml
  4. 1 5
      tasks/rabbit.yml
  5. 1 5
      tasks/redis.yml
  6. 1 5
      tasks/server.yml

+ 1 - 5
tasks/client.yml

@@ -19,11 +19,7 @@
               src={{ sensu_client_config  }}
     notify: restart sensu-client service
 
-  - include: SmartOS/client.yml
-    when: ansible_distribution == SmartOS
-
-  - include: Ubuntu/client.yml
-    when: ansible_distribution == Ubuntu
+  - include: "{{ ansible_distribution }}/client.yml"
 
   - name: Ensure Sensu client service is running
     service: name=sensu-client state=started enabled=yes

+ 1 - 5
tasks/dashboard.yml

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

+ 1 - 5
tasks/main.yml

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

+ 1 - 5
tasks/rabbit.yml

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

+ 1 - 5
tasks/redis.yml

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

+ 1 - 5
tasks/server.yml

@@ -12,11 +12,7 @@
               src=sensu-redis.json.j2
     notify: restart sensu-api service
 
-  - include: SmartOS/server.yml
-    when: ansible_distribution == SmartOS
-
-  - include: Ubuntu/server.yml
-    when: ansible_distribution == Ubuntu
+  - include: "{{ ansible_distribution }}/server.yml"
 
   - name: Ensure Sensu server service is running
     service: name=sensu-server state=started enabled=yes