Salt-ssh support
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index e6520ad..4fa6f4a 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -3,6 +3,13 @@
salt-formula
============
+0.0.4
+-----
+
+- Salt-virt
+- Salt API
+
+
0.0.3
-----
diff --git a/README.rst b/README.rst
index a46f85b..5ab48b3 100644
--- a/README.rst
+++ b/README.rst
@@ -177,6 +177,26 @@
".*":
- x509.sign_remote_certificate
+
+Salt SSH
+--------
+
+Salt SSH with sudoer using key
+
+.. literalinclude:: tests/pillar/master_ssh_minion_key.sls
+ :language: yaml
+
+Salt SSH with sudoer using password
+
+.. literalinclude:: tests/pillar/master_ssh_minion_password.sls
+ :language: yaml
+
+Salt SSH with root using password
+
+.. literalinclude:: tests/pillar/master_ssh_minion_root.sls
+ :language: yaml
+
+
Salt minion
-----------
@@ -212,6 +232,7 @@
.. literalinclude:: tests/pillar/minion_pki_cert.sls
:language: yaml
+
Salt control (cloud/kvm/docker)
-------------------------------
@@ -225,7 +246,7 @@
.. literalinclude:: tests/pillar/control_cloud_digitalocean.sls
:language: yaml
-Salt virt KVM cluster
+Salt virt with KVM cluster
.. literalinclude:: tests/pillar/control_virt.sls
:language: yaml
@@ -270,32 +291,3 @@
* http://salt-cloud.readthedocs.org/en/latest/topics/map.html
* http://docs.saltstack.com/en/latest/topics/tutorials/multimaster.html
-salt-virt
----------
-
-Sample pillar
-
-.. code-block:: yaml
-
- salt:
- control:
- enabled: True
- virt_enabled: True
- size:
- medium:
- cpu: 2
- ram: 1024
- cluster:
- localnode:
- domain: domain.com
- engine: virt
- config:
- engine: salt
- host: 127.0.0.1
- node:
- ubuntu01:
- provider: node001.domain.com
- image: ubuntu-14-04-x64-1456128611.qcow2
- size: medium
- disk_profile: database
- net_profile: testing
diff --git a/VERSION b/VERSION
index 3b04cfb..bd73f47 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.2
+0.4
diff --git a/metadata.yml b/metadata.yml
index b5b013c..d75dea4 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,5 +1,5 @@
name: "salt"
-version: "0.2"
+version: "0.4"
source: "https://github.com/tcpcloud/salt-formula-salt"
dependencies:
- name: git
diff --git a/salt/files/roster b/salt/files/roster
new file mode 100644
index 0000000..e59daf2
--- /dev/null
+++ b/salt/files/roster
@@ -0,0 +1,16 @@
+{%- from "salt/map.jinja" import master with context %}
+{%- for minion_name, minion in master.get('ssh_minion', {}).items() %}
+{{ minion_name }}:
+ host: {{ minion.host }}
+ user: {{ minion.user }}
+ {%- if minion.password is defined %}
+ passwd: {{ minion.password }}
+ {%- endif %}
+ {%- if minion.key_file is defined %}
+ priv: {{ minion.key_file }}
+ {%- endif %}
+ {%- if minion.get('sudo', False) %}
+ sudo: True
+ tty: True
+ {%- endif %}
+{%- endfor %}
diff --git a/salt/master/init.sls b/salt/master/init.sls
index 139b142..378baa2 100644
--- a/salt/master/init.sls
+++ b/salt/master/init.sls
@@ -6,6 +6,9 @@
{%- if pillar.salt.master.windows_repo is defined %}
- salt.master.win_repo
{%- endif %}
+{%- if pillar.salt.master.ssh_minion is defined %}
+- salt.master.ssh
+{%- endif %}
{#
- salt.master.orchestrate
#}
\ No newline at end of file
diff --git a/salt/master/ssh.sls b/salt/master/ssh.sls
new file mode 100644
index 0000000..bbc3bc3
--- /dev/null
+++ b/salt/master/ssh.sls
@@ -0,0 +1,17 @@
+{%- from "salt/map.jinja" import master with context %}
+{%- if master.enabled %}
+
+include:
+- salt.master.service
+
+/etc/salt/roster:
+ file.managed:
+ - source: salt://salt/files/roster
+ - user: root
+ - template: jinja
+ - require:
+ - {{ master.install_state }}
+ - watch_in:
+ - service: salt_master_service
+
+{%- endif %}
\ No newline at end of file
diff --git a/tests/pillar/control_virt.sls b/tests/pillar/control_virt.sls
index e07319b..e84c5dd 100644
--- a/tests/pillar/control_virt.sls
+++ b/tests/pillar/control_virt.sls
@@ -31,4 +31,4 @@
ubuntu2:
provider: node02.domain.com
image: bubuntu.qcomw
- size: small
\ No newline at end of file
+ size: small
diff --git a/tests/pillar/master_ssh_minion_key.sls b/tests/pillar/master_ssh_minion_key.sls
new file mode 100644
index 0000000..92ead37
--- /dev/null
+++ b/tests/pillar/master_ssh_minion_key.sls
@@ -0,0 +1,10 @@
+salt:
+ master:
+ enabled: true
+ ssh_minion:
+ node01:
+ host: 10.0.0.1
+ user: saltssh
+ sudo: true
+ key_file: /path/to/the/key
+ port: 22
diff --git a/tests/pillar/master_ssh_minion_password.sls b/tests/pillar/master_ssh_minion_password.sls
new file mode 100644
index 0000000..e3c9c82
--- /dev/null
+++ b/tests/pillar/master_ssh_minion_password.sls
@@ -0,0 +1,10 @@
+salt:
+ master:
+ enabled: true
+ ssh_minion:
+ node01:
+ host: 10.0.0.1
+ user: saltssh
+ sudo: true
+ password: password
+ port: 22
diff --git a/tests/pillar/master_ssh_minion_root.sls b/tests/pillar/master_ssh_minion_root.sls
new file mode 100644
index 0000000..2e72678
--- /dev/null
+++ b/tests/pillar/master_ssh_minion_root.sls
@@ -0,0 +1,9 @@
+salt:
+ master:
+ enabled: true
+ ssh_minion:
+ node01:
+ host: 10.0.0.1
+ user: root
+ password: password
+ port: 22