diff --git a/pillar.example b/pillar.example index f51361a..24d8fa3 100644 --- a/pillar.example +++ b/pillar.example @@ -67,6 +67,8 @@ salt: # source_files: # salt-master: # - 'alt_master.d' + # salt-minion: + # - 'alt_minion.d' # salt master config master_config_use_TOFS: True @@ -150,6 +152,7 @@ salt: - /srv/salt/reactors/deploy.sls # salt minion config: + minion_config_use_TOFS: True minion: # single master setup diff --git a/salt/defaults.yaml b/salt/defaults.yaml index 1083996..44ea3aa 100644 --- a/salt/defaults.yaml +++ b/salt/defaults.yaml @@ -10,6 +10,7 @@ salt: minion_remove_config: False master_remove_config: False + minion_config_use_TOFS: False master_config_use_TOFS: False minion_service: salt-minion diff --git a/salt/files/default/minion.d/beacons.conf b/salt/files/default/minion.d/beacons.conf new file mode 100644 index 0000000..d57d388 --- /dev/null +++ b/salt/files/default/minion.d/beacons.conf @@ -0,0 +1,4 @@ +######################################################################## +## File managed by Salt. +## Your changes will be overwritten. +######################################################################## diff --git a/salt/files/default/minion.d/engine.conf b/salt/files/default/minion.d/engine.conf new file mode 100644 index 0000000..d57d388 --- /dev/null +++ b/salt/files/default/minion.d/engine.conf @@ -0,0 +1,4 @@ +######################################################################## +## File managed by Salt. +## Your changes will be overwritten. +######################################################################## diff --git a/salt/files/default/minion.d/f_defaults.conf b/salt/files/default/minion.d/f_defaults.conf new file mode 100644 index 0000000..d57d388 --- /dev/null +++ b/salt/files/default/minion.d/f_defaults.conf @@ -0,0 +1,4 @@ +######################################################################## +## File managed by Salt. +## Your changes will be overwritten. +######################################################################## diff --git a/salt/files/default/minion.d/reactor.conf b/salt/files/default/minion.d/reactor.conf new file mode 100644 index 0000000..d57d388 --- /dev/null +++ b/salt/files/default/minion.d/reactor.conf @@ -0,0 +1,4 @@ +######################################################################## +## File managed by Salt. +## Your changes will be overwritten. +######################################################################## diff --git a/salt/minion.sls b/salt/minion.sls index 6022fe9..391defa 100644 --- a/salt/minion.sls +++ b/salt/minion.sls @@ -1,4 +1,6 @@ -{% from "salt/map.jinja" import salt_settings with context %} +{%- set tplroot = tpldir.split('/')[0] %} +{%- from tplroot ~ "/map.jinja" import salt_settings with context %} +{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %} {% if salt_settings.install_packages and grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source != '' and salt_settings.version != '' %} {# only download IF we know where to get the pkg from and if we know what version to check the current install (if installed) against #} @@ -45,12 +47,20 @@ salt-minion: {% endif %} file.recurse: - name: {{ salt_settings.config_path }}/minion.d + {%- if salt_settings.minion_config_use_TOFS %} + - template: '' + - source: {{ files_switch(['minion.d'], + lookup='salt-minion' + ) + }} + {%- else %} - template: jinja - source: salt://{{ slspath }}/files/minion.d - - clean: {{ salt_settings.clean_config_d_dir }} - - exclude_pat: _* - context: standalone: False + {%- endif %} + - clean: {{ salt_settings.clean_config_d_dir }} + - exclude_pat: _* service.running: - enable: True - name: {{ salt_settings.minion_service }}