Merge branch 'feature/installation-source-pip' into 'master'
Optional installation source - pip
source:engine metadata created - defaults to pkg installation, pip
installation alternative added
See merge request !5
diff --git a/README.rst b/README.rst
index ec4f666..f63aa65 100644
--- a/README.rst
+++ b/README.rst
@@ -45,6 +45,18 @@
minions:
- name: 'node1.system.location.domain.com'
+Salt master with alternative installation source and version (optional) - pip
+
+.. code-block:: yaml
+
+ salt:
+ master:
+ enabled: true
+ ...
+ source:
+ engine: pip
+ version: 2016.3.0rc2
+
Salt master syndicate master of masters
.. code-block:: yaml
@@ -216,4 +228,4 @@
image: ubuntu-14-04-x64-1456128611.qcow2
size: medium
disk_profile: database
- net_profile: testing
\ No newline at end of file
+ net_profile: testing
diff --git a/metadata/service/master/cluster.yml b/metadata/service/master/cluster.yml
index da339d2..69d192b 100644
--- a/metadata/service/master/cluster.yml
+++ b/metadata/service/master/cluster.yml
@@ -8,5 +8,7 @@
salt:
master:
enabled: true
+ source:
+ engine: pkg
command_timeout: 5
- worker_threads: 2
\ No newline at end of file
+ worker_threads: 2
diff --git a/metadata/service/master/single.yml b/metadata/service/master/single.yml
index a0033f9..b1a0e67 100644
--- a/metadata/service/master/single.yml
+++ b/metadata/service/master/single.yml
@@ -10,6 +10,8 @@
salt:
master:
enabled: true
+ source:
+ engine: pkg
command_timeout: 5
worker_threads: 2
- base_environment: ${_param:salt_master_base_environment}
\ No newline at end of file
+ base_environment: ${_param:salt_master_base_environment}
diff --git a/metadata/service/minion/cluster.yml b/metadata/service/minion/cluster.yml
index 2bc0513..91aaaaa 100644
--- a/metadata/service/minion/cluster.yml
+++ b/metadata/service/minion/cluster.yml
@@ -6,6 +6,8 @@
salt:
minion:
enabled: true
+ source:
+ engine: pkg
masters:
- host: ${_param:salt_master_host}
- host: ${_param:salt_master_host}
diff --git a/metadata/service/minion/local.yml b/metadata/service/minion/local.yml
index 74e956f..93d7772 100644
--- a/metadata/service/minion/local.yml
+++ b/metadata/service/minion/local.yml
@@ -6,6 +6,8 @@
salt:
minion:
enabled: true
+ source:
+ engine: pkg
local: true
pillar:
engine: reclass
diff --git a/metadata/service/minion/master.yml b/metadata/service/minion/master.yml
index c578635..3a8561a 100644
--- a/metadata/service/minion/master.yml
+++ b/metadata/service/minion/master.yml
@@ -6,6 +6,8 @@
salt:
minion:
enabled: true
+ source:
+ engine: pkg
master:
host: ${_param:salt_master_host}
mine:
diff --git a/salt/api.sls b/salt/api.sls
index 5d53d9d..4e3fe4a 100644
--- a/salt/api.sls
+++ b/salt/api.sls
@@ -8,7 +8,7 @@
pkg.installed
- names: {{ api.pkgs }}
- require:
- - pkg: salt_master_packages
+ - {{ master.install_state }}
salt_api_service:
service.running:
@@ -18,4 +18,4 @@
- watch:
- file: /etc/salt/master
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/salt/map.jinja b/salt/map.jinja
index 9ba416a..c1e8e1a 100644
--- a/salt/map.jinja
+++ b/salt/map.jinja
@@ -2,6 +2,16 @@
{%- load_yaml as master_common %}
default:
service: salt-master
+ {%- if pillar.salt.master is defined %}
+ {%- if pillar.salt.master.source.engine == 'pkg' %}
+ install_state: "pkg: salt_master_packages"
+ {%- elif pillar.salt.master.source.engine == 'pip' %}
+ install_state: "pip: salt_master_packages"
+ {%- endif %}
+ {%- endif %}
+ {%- if pillar.salt.master.source.version is defined %}
+ version: {{ pillar.salt.master.source.version }}
+ {%- endif %}
accept_policy: preseed
bind: {}
formula: {}
@@ -43,6 +53,16 @@
- python-yaml
graph_states: False
service: salt-minion
+ {%- if pillar.salt.minion is defined %}
+ {%- if pillar.salt.minion.source.engine == 'pkg' %}
+ install_state: "pkg: salt_minion_packages"
+ {%- elif pillar.salt.minion.source.engine == 'pip' %}
+ install_state: "pip: salt_minion_packages"
+ {%- endif %}
+ {%- endif %}
+ {%- if pillar.salt.minion.source.version is defined %}
+ version: {{ pillar.salt.minion.source.version }}
+ {%- endif %}
{%- endload %}
{%- load_yaml as minion_specific %}
diff --git a/salt/master/api.sls b/salt/master/api.sls
index 4583b04..c60f24a 100644
--- a/salt/master/api.sls
+++ b/salt/master/api.sls
@@ -9,7 +9,7 @@
- names:
- salt-api
- require:
- - pkg: salt_master_packages
+ - {{ master.install_state }}
salt_api_service:
service.running:
diff --git a/salt/master/minion.sls b/salt/master/minion.sls
index d797b9f..50fc63e 100644
--- a/salt/master/minion.sls
+++ b/salt/master/minion.sls
@@ -10,7 +10,7 @@
file.directory:
- makedirs: true
- require:
- - pkg: salt_master_packages
+ - {{ master.install_state }}
{%- for name, environment in master.environment.iteritems() %}
diff --git a/salt/master/service.sls b/salt/master/service.sls
index 76f3ca2..29e59b4 100644
--- a/salt/master/service.sls
+++ b/salt/master/service.sls
@@ -1,9 +1,22 @@
{%- from "salt/map.jinja" import master with context %}
{%- if master.enabled %}
+{%- if master.source.get('engine', 'pkg') == 'pkg' %}
+
salt_master_packages:
pkg.latest:
- names: {{ master.pkgs }}
+ {%- if master.source.version is defined %}
+ - version: {{ master.source.version }}
+ {%- endif %}
+
+{%- elif master.source.get('engine', 'pkg') == 'pip' %}
+
+salt_master_packages:
+ pip.installed:
+ - name: salt{% if master.source.version is defined %}=={{ master.source.version }}{% endif %}
+
+{%- endif %}
/etc/salt/master.d/master.conf:
file.managed:
@@ -11,7 +24,7 @@
- user: root
- template: jinja
- require:
- - pkg: salt_master_packages
+ - {{ master.install_state }}
- watch_in:
- service: salt_master_service
@@ -23,7 +36,7 @@
- user: root
- template: jinja
- require:
- - pkg: salt_master_packages
+ - {{ master.install_state }}
- watch_in:
- service: salt_master_service
@@ -40,4 +53,4 @@
- mode: 755
- makedirs: true
-{%- endif %}
\ No newline at end of file
+{%- endif %}
diff --git a/salt/minion/ca.sls b/salt/minion/ca.sls
index 196359d..9966293 100644
--- a/salt/minion/ca.sls
+++ b/salt/minion/ca.sls
@@ -9,7 +9,7 @@
- source: salt://salt/files/_pki.conf
- template: jinja
- require:
- - pkg: salt_minion_packages
+ - {{ minion.install_state }}
- watch_in:
- service: salt_minion_service
diff --git a/salt/minion/grains.sls b/salt/minion/grains.sls
index f1003b1..af57b34 100644
--- a/salt/minion/grains.sls
+++ b/salt/minion/grains.sls
@@ -11,7 +11,7 @@
- makedirs: true
- user: root
- require:
- - pkg: salt_minion_packages
+ - {{ minion.install_state }}
salt_minion_grains_placeholder:
file.touch:
diff --git a/salt/minion/graph.sls b/salt/minion/graph.sls
index 440bad2..8587301 100644
--- a/salt/minion/graph.sls
+++ b/salt/minion/graph.sls
@@ -5,7 +5,7 @@
pkg.latest:
- names: {{ minion.graph_pkgs }}
- require:
- - pkg: salt_minion_packages
+ - {{ minion.install_state }}
salt_graph_states_packages:
pkg.latest:
diff --git a/salt/minion/service.sls b/salt/minion/service.sls
index 1f7ce58..5c458b1 100644
--- a/salt/minion/service.sls
+++ b/salt/minion/service.sls
@@ -1,9 +1,22 @@
{%- from "salt/map.jinja" import minion with context %}
{%- if minion.enabled %}
+{%- if minion.source.get('engine', 'pkg') == 'pkg' %}
+
salt_minion_packages:
pkg.latest:
- names: {{ minion.pkgs }}
+ {%- if minion.source.version is defined %}
+ - version: {{ minion.source.version }}
+ {%- endif %}
+
+{%- elif minion.source.get('engine', 'pkg') == 'pip' %}
+
+salt_minion_packages:
+ pip.installed:
+ - name: salt{% if minion.source.version is defined %}=={{ minion.source.version }}{% endif %}
+
+{%- endif %}
/etc/salt/minion.d/minion.conf:
file.managed:
@@ -12,7 +25,7 @@
- group: root
- template: jinja
- require:
- - pkg: salt_minion_packages
+ - {{ minion.install_state }}
- watch_in:
- service: salt_minion_service
@@ -21,4 +34,4 @@
- name: {{ minion.service }}
- enable: true
-{%- endif %}
\ No newline at end of file
+{%- endif %}