Job builder tuning
diff --git a/jenkins/job_builder.sls b/jenkins/job_builder.sls
index d1525ba..15ada34 100644
--- a/jenkins/job_builder.sls
+++ b/jenkins/job_builder.sls
@@ -1,29 +1,18 @@
 {% from "jenkins/map.jinja" import job_builder with context %}
-{%- if pillar.jenkins.job_builder.enabled %}
+{%- if job_builder.enabled %}
 
 include:
 - git
 
-{%- if not job_builder.pkgs %}
-# Install job builder with pip if we don't have package
-
-include:
-- python
-
-jenkins_job_builder_install:
-  pip.installed:
-    - names:
-      - jenkins-job-builder
-    - require:
-      - pkg: jenkins_job_builder_packages
-
-{%- else %}
+{%- if job_builder.source.engine == 'pkg' %}
 
 jenkins_job_builder_install:
   pkg.installed:
-    - names: {{ job_builder.pkgs }}
-    - require:
-      - pkg: jenkins_job_builder_packages
+  - names: {{ job_builder.pkgs }}
+  - require_in:
+    - cmd: jenkins_job_builder_jobs_update
+
+{%- else %}
 
 jenkins_job_builder_packages:
   pkg.installed:
@@ -32,26 +21,29 @@
     - python-jenkins
     - python-pip
     - python-pbr
+
+jenkins_job_builder_install:
+  pip.installed:
+  - names:
+    - jenkins-job-builder
   - require:
-    - pkg: python_packages
+    - pkg: jenkins_job_builder_packages
+  - require_in:
+    - cmd: jenkins_job_builder_jobs_update
 
 {%- endif %}
 
-/srv/jenkins:
+jenkins_job_dirs:
   file.directory:
+  - names:
+    - {{ job_builder.dir.base }}
+    - {{ job_builder.dir.conf }}
   - user: root
   - group: root
   - mode: 755
   - makedirs: true
 
-{{ job_builder.conf_dir }}:
-  file.directory:
-  - user: root
-  - group: root
-  - mode: 755
-  - makedirs: true
-
-{{ job_builder.config_file }}:
+{{ job_builder.dir.conf }}/jenkins_jobs.ini:
   file.managed:
   - source: salt://jenkins/files/jenkins_jobs.ini
   - user: root
@@ -59,25 +51,20 @@
   - mode: 400
   - template: jinja
   - require:
-    - file: /etc/jenkins_jobs
+    - file: jenkins_job_dirs
 
-{{ pillar.jenkins.job_builder.config.address }}:
+{{ job_builder.config.address }}:
   git.latest:
   - target: /srv/jenkins/job_builder_config
-  - rev: {{ pillar.jenkins.job_builder.config.branch }}
+  - rev: {{ job_builder.config.branch }}
   - require:
-    - file: /srv/jenkins
+    - file: jenkins_job_dirs
 
 jenkins_job_builder_jobs_update:
   cmd.run:
   - name: jenkins-jobs update /srv/jenkins/job_builder_config
   - require:
-    - git: {{ pillar.jenkins.job_builder.config.address }}
-    - file: {{ job_builder.config_file }}
-    {%- if not job_builder.pkgs %}
-    - pkg: jenkins_job_builder_install
-    {%- else %}
-    - pip: jenkins_job_builder_install
-    {%- endif %}
+    - git: {{ job_builder.config.address }}
+    - file: {{ job_builder.dir.conf }}/jenkins_jobs.ini
 
 {%- endif %}
diff --git a/jenkins/map.jinja b/jenkins/map.jinja
index 5d446ca..160bb35 100644
--- a/jenkins/map.jinja
+++ b/jenkins/map.jinja
@@ -15,13 +15,23 @@
 {% set job_builder = salt['grains.filter_by']({
     'Debian': {
         'pkgs': ['jenkins-job-builder', 'jenkins-jobs-slack'],
-        'config_file': '/etc/jenkins_jobs/jenkins_jobs.ini',
-        'conf_dir': '/etc/jenkins_jobs',
+        'dir': {
+            'conf': '/etc/jenkins_jobs',
+            'base': '/srv/jenkins_jobs'
+        },
+        'source': {
+            'engine': 'pkg'
+        }
     },
     'RedHat': {
         'pkgs': ['jenkins-job-builder', 'jenkins-jobs-slack'],
-        'config_file': '/etc/jenkins_jobs/jenkins_jobs.ini',
-        'conf_dir': '/etc/jenkins_jobs',
+        'dir': {
+            'conf': '/etc/jenkins_jobs',
+            'base': '/srv/jenkins_jobs'
+        },
+        'source': {
+            'engine': 'pkg'
+        }
     },
 }, merge=salt['pillar.get']('jenkins:job_builder')) %}