Parcourir la source

Setting explicit paths for include/template data

cmacrae il y a 10 ans
Parent
commit
b038ab9268

+ 3 - 7
tasks/SmartOS/client.yml

@@ -1,16 +1,12 @@
 ---
-# tasks/client.yml: Deploy various client-side configurations for Sensu
+# tasks/SmartOS/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
+  - include_vars: ../../vars/{{ ansible_distribution }}.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
+              src=../../templates/sensu-client.smartos_smf_manifest.xml.j2
               owner=root group=root mode=644
     notify: import sensu-client service
               

+ 5 - 3
tasks/SmartOS/dashboard.yml

@@ -2,6 +2,8 @@
 # tasks/SmartOS/dashboard.yml: Deployment of the Uchiwa dashboard
 # Specific to Joyent SmartOS
 
+  - include_vars: ../../vars/{{ ansible_distribution }}.yml
+
   - name: Ensure Uchiwa (dashboard) dependencies are installed
     pkgin: name=go state=present
 
@@ -47,19 +49,19 @@
     sudo_user: "{{ sensu_user_name }}"
 
   - name: Deploy Uchiwa config
-    template: src=uchiwa_config.json.j2 dest={{ uchiwa_path }}/etc/config.json
+    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
 
   - name: Deploy Uchiwa service script
-    template: src=uchiwa.sh.j2
+    template: src=../../templates/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
+              src=../../templates/uchiwa.smartos_smf_manifest.xml.j2
               owner=root group=root mode=644
     notify: import uchiwa service
 

+ 1 - 5
tasks/SmartOS/main.yml

@@ -2,11 +2,7 @@
 # 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
+  - include_vars: ../../vars/{{ ansible_distribution }}.yml
 
   - name: Ensure the Sensu group is present
     group: name={{ sensu_group_name }}

+ 1 - 5
tasks/SmartOS/redis.yml

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

+ 4 - 2
tasks/SmartOS/server.yml

@@ -3,15 +3,17 @@
 # a Sensu 'master' node.
 # Specific to SmartOS
 
+  - include_vars: ../../vars/{{ ansible_distribution }}.yml
+
   - name: Deploy Sensu server service manifest
     template: dest=/opt/local/lib/svc/manifest/sensu-server.xml
-              src=sensu-server.smartos_smf_manifest.xml.j2
+              src=../../templates/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
+              src=../../templates/sensu-api.smartos_smf_manifest.xml.j2
               owner=root group=root mode=644
     notify: import sensu-api service
  

+ 1 - 5
tasks/Ubuntu/dashboard.yml

@@ -2,11 +2,7 @@
 # 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
+  - include_vars: ../../vars/{{ ansible_distribution }}.yml
 
   - name: Retrieve the Uchiwa deb package
     get_url: url={{ uchiwa_pkg_download_url }}

+ 2 - 0
tasks/Ubuntu/main.yml

@@ -2,6 +2,8 @@
 # tasks/Ubuntu/main.yml: Ubuntu specific set-up
 # This takes care of base prerequisites for Ubuntu
 
+  - include_vars: ../../vars/{{ ansible_distribution }}.yml
+
   - name: Ensure the Sensu APT repo GPG key is present
     apt_key: url=http://repositories.sensuapp.org/apt/pubkey.gpg
              state=present

+ 1 - 5
tasks/Ubuntu/rabbit.yml

@@ -2,11 +2,7 @@
 # tasks/Ubuntu/rabbit.yml: Deploy RabbitMQ
 # Specific to Ubuntu
 
-  - include_vars: "{{ item }}"
-    with_first_found:
-      - "{{ ansible_distribution }}.yml"
-      - "{{ ansible_os_family }}.yml"
-      - default.yml
+  - include_vars: ../../vars/{{ ansible_distribution }}.yml
 
   - name: Ensure the RabbitMQ APT repo GPG key is present
     apt_key: url=https://www.rabbitmq.com/rabbitmq-signing-key-public.asc

+ 1 - 5
tasks/Ubuntu/redis.yml

@@ -2,11 +2,7 @@
 # tasks/Ubuntu/redis.yml: Deploy Redis
 # Specific to Ubuntu
 
-  - include_vars: "{{ item }}"
-    with_first_found:
-      - "{{ ansible_distribution }}.yml"
-      - "{{ ansible_os_family }}.yml"
-      - default.yml
+  - include_vars: ../../vars/{{ ansible_distribution }}.yml
 
   - name: Ensure the Redis APT repo is present
     apt_repository: repo={{ redis_pkg_repo }}

+ 0 - 2
tasks/client.yml

@@ -4,8 +4,6 @@
   - include_vars: "{{ item }}"
     with_first_found:
       - "{{ ansible_distribution }}.yml"
-      - "{{ 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

+ 4 - 0
tasks/main.yml

@@ -1,6 +1,10 @@
 ---
 # tasks/main.yml: "Master" playbook for the cmacrae.sensu role
 
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+
   - include: SmartOS/main.yml tags=setup
     when: ansible_distribution == "SmartOS"
 

+ 0 - 2
tasks/plugins.yml

@@ -4,8 +4,6 @@
   - include_vars: "{{ item }}"
     with_first_found:
       - "{{ ansible_distribution }}.yml"
-      - "{{ ansible_os_family }}.yml"
-      - default.yml
 
   - name: Ensure Sensu plugin directory exists
     file: dest={{ sensu_config_path }}/plugins state=directory

+ 0 - 2
tasks/rabbit.yml

@@ -4,8 +4,6 @@
   - include_vars: "{{ item }}"
     with_first_found:
       - "{{ ansible_distribution }}.yml"
-      - "{{ ansible_os_family }}.yml"
-      - default.yml
 
   - include: SmartOS/rabbit.yml
     when: ansible_distribution == "SmartOS"

+ 4 - 0
tasks/server.yml

@@ -1,5 +1,9 @@
 ---
 
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.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 }}

+ 0 - 2
tasks/ssl.yml

@@ -4,8 +4,6 @@
   - include_vars: "{{ item }}"
     with_first_found:
       - "{{ ansible_distribution }}.yml"
-      - "{{ ansible_os_family }}.yml"
-      - default.yml
 
   - include: ssl_generate.yml
     when: sensu_ssl_gen_certs

+ 4 - 0
tasks/ssl_generate.yml

@@ -2,6 +2,10 @@
 # tasks/ssl_generate.yml: Generate SSL data and stash to dynamic
 # data store for deployment to clients
 
+  - include_vars: "{{ item }}"
+    with_first_found:
+      - "{{ ansible_distribution }}.yml"
+
   - name: Ensure Sensu SSL directory exists
     file: dest={{ sensu_config_path }}/ssl state=directory
           owner={{ sensu_user_name }} group={{ sensu_group_name }}