From b93ec22244e28f35fc5b430943e6b38666891d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Hertzog?= Date: Sun, 21 Dec 2014 15:35:45 +0100 Subject: [PATCH] =?UTF-8?q?Add=20a=20=E2=80=9Csalt.standalone=E2=80=9D=20s?= =?UTF-8?q?tate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.rst | 6 ++++++ salt/files/minion.d/_defaults.conf | 4 ++++ salt/minion.sls | 2 ++ salt/standalone.sls | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 salt/standalone.sls diff --git a/README.rst b/README.rst index c61eb0c..62724dc 100644 --- a/README.rst +++ b/README.rst @@ -41,6 +41,12 @@ Install salt cloud. Install salt-ssh with roster file. Configure pillar data under salt:ssh_roster to feed the template. +``salt.standalone`` +------------ + +Install a minion and configure it in `standalone mode +`_. + ``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']`` diff --git a/salt/files/minion.d/_defaults.conf b/salt/files/minion.d/_defaults.conf index 26a5772..95be519 100644 --- a/salt/files/minion.d/_defaults.conf +++ b/salt/files/minion.d/_defaults.conf @@ -386,7 +386,11 @@ id: {{ minion['id'] }} # Set the file client. The client defaults to looking on the master server for # files, but can be directed to look at the local file directory setting # defined below by setting it to local. +{%- if standalone %} +file_client: local +{%- else %} {{ get_config('file_client', 'remote') }} +{%- endif %} # The file directory works on environments passed to the minion, each environment # can have multiple root directories, the subdirectories in the multiple file diff --git a/salt/minion.sls b/salt/minion.sls index 15b4f75..a80e210 100644 --- a/salt/minion.sls +++ b/salt/minion.sls @@ -8,6 +8,8 @@ salt-minion: - template: jinja - source: salt://salt/files/minion.d - clean: True + - context: + standalone: False service.running: - enable: True - name: {{ pkgs.get('minion-service', 'salt-minion') }} diff --git a/salt/standalone.sls b/salt/standalone.sls new file mode 100644 index 0000000..e33da85 --- /dev/null +++ b/salt/standalone.sls @@ -0,0 +1,18 @@ +{% from "salt/package-map.jinja" import pkgs with context %} + +salt-minion: + pkg.installed: + - name: {{ pkgs['salt-minion'] }} + file.recurse: + - name: {{ pkgs.get('config-path', '/etc/salt') }}/minion.d + - template: jinja + - source: salt://salt/files/minion.d + - clean: True + - context: + standalone: True + service.dead: + - enable: False + - name: {{ pkgs.get('minion-service', 'salt-minion') }} + - require: + - pkg: salt-minion + - file: salt-minion