2
0

add support for installing salt-ssh and managing the roster file, updated README and pillar.example

This commit is contained in:
Tim O'Guin 2014-10-28 11:45:32 -05:00
parent 9fa42fe09d
commit cde16097ed
5 changed files with 39 additions and 1 deletions

View File

@ -35,6 +35,12 @@ Install a syndic.
Install salt cloud. Install salt cloud.
``salt.ssh``
------------
Install salt-ssh with roster file.
Configure pillar data under salt:ssh_roster to feed the template.
``Configuration`` ``Configuration``
================= =================
Every option available in the templates can be set in pillar. Settings under 'salt' will be overridden by more specific settings under ``salt['master']``, ``salt['minion']`` or ``salt['cloud']`` Every option available in the templates can be set in pillar. Settings under 'salt' will be overridden by more specific settings under ``salt['master']``, ``salt['minion']`` or ``salt['cloud']``

View File

@ -45,6 +45,12 @@ salt:
reactor: reactor:
- 'deploy': - 'deploy':
- /srv/salt/reactors/deploy.sls - /srv/salt/reactors/deploy.sls
ssh_roster:
prod1:
host: host.example.com
user: ubuntu
sudo: True
priv: /etc/salt/ssh_keys/sshkey.pem
salt_cloud_certs: salt_cloud_certs:
aws: aws:

12
salt/files/roster.jinja Normal file
View File

@ -0,0 +1,12 @@
#
# This file is managed by Salt! Do not edit by hand!
#
{%- set roster = salt['pillar.get']('salt:ssh_roster') -%}
{%- if roster %}
{%- for host, options in roster.items() %}
{{ host }}:
{%- for k, v in options.items() %}
{{ k }}: {{ v }}
{%- endfor %}
{% endfor %}
{%- endif -%}

View File

@ -6,7 +6,8 @@
'Ubuntu': {'salt-master': 'salt-master', 'Ubuntu': {'salt-master': 'salt-master',
'salt-minion': 'salt-minion', 'salt-minion': 'salt-minion',
'salt-syndic': 'salt-syndic', 'salt-syndic': 'salt-syndic',
'salt-cloud': 'salt-cloud'}, 'salt-cloud': 'salt-cloud',
'salt-ssh': 'salt-ssh'},
'CentOS': {'salt-master': 'salt-master', 'CentOS': {'salt-master': 'salt-master',
'salt-minion': 'salt-minion', 'salt-minion': 'salt-minion',
'salt-syndic': 'salt-syndic', 'salt-syndic': 'salt-syndic',

13
salt/ssh.sls Normal file
View File

@ -0,0 +1,13 @@
{% from "salt/package-map.jinja" import pkgs with context %}
ensure salt-ssh is installed:
pkg.installed:
- name: {{ pkgs['salt-ssh'] }}
ensure roster config:
file.managed:
- name: {{ pkgs.get('config_path', '/etc/salt') }}/roster
- source: salt://salt/files/roster.jinja
- template: jinja
- require:
- pkg: ensure salt-ssh is installed