From 1b202afb2903fcbdb7f5da4dfc565bcd008a24db Mon Sep 17 00:00:00 2001 From: Imran Iqbal Date: Fri, 7 Jun 2019 03:54:24 +0100 Subject: [PATCH] feat(`tofs`): allow TOFS for master configuration --- pillar.example | 5 ++++- salt/defaults.yaml | 1 + salt/files/default/master.d/engine.conf | 4 ++++ salt/files/default/master.d/f_defaults.conf | 4 ++++ salt/files/default/master.d/lxc_profiles.conf | 4 ++++ salt/files/default/master.d/reactor.conf | 4 ++++ salt/master.sls | 12 +++++++++++- 7 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 salt/files/default/master.d/engine.conf create mode 100644 salt/files/default/master.d/f_defaults.conf create mode 100644 salt/files/default/master.d/lxc_profiles.conf create mode 100644 salt/files/default/master.d/reactor.conf diff --git a/pillar.example b/pillar.example index 50ef1a0..f51361a 100644 --- a/pillar.example +++ b/pillar.example @@ -64,9 +64,12 @@ salt: # dirs: # files: files_alt # default: default_alt - # source_files: {} + # source_files: + # salt-master: + # - 'alt_master.d' # salt master config + master_config_use_TOFS: True master: fileserver_backend: - git diff --git a/salt/defaults.yaml b/salt/defaults.yaml index 12e22f8..1083996 100644 --- a/salt/defaults.yaml +++ b/salt/defaults.yaml @@ -10,6 +10,7 @@ salt: minion_remove_config: False master_remove_config: False + master_config_use_TOFS: False minion_service: salt-minion master_service: salt-master diff --git a/salt/files/default/master.d/engine.conf b/salt/files/default/master.d/engine.conf new file mode 100644 index 0000000..d57d388 --- /dev/null +++ b/salt/files/default/master.d/engine.conf @@ -0,0 +1,4 @@ +######################################################################## +## File managed by Salt. +## Your changes will be overwritten. +######################################################################## diff --git a/salt/files/default/master.d/f_defaults.conf b/salt/files/default/master.d/f_defaults.conf new file mode 100644 index 0000000..d57d388 --- /dev/null +++ b/salt/files/default/master.d/f_defaults.conf @@ -0,0 +1,4 @@ +######################################################################## +## File managed by Salt. +## Your changes will be overwritten. +######################################################################## diff --git a/salt/files/default/master.d/lxc_profiles.conf b/salt/files/default/master.d/lxc_profiles.conf new file mode 100644 index 0000000..d57d388 --- /dev/null +++ b/salt/files/default/master.d/lxc_profiles.conf @@ -0,0 +1,4 @@ +######################################################################## +## File managed by Salt. +## Your changes will be overwritten. +######################################################################## diff --git a/salt/files/default/master.d/reactor.conf b/salt/files/default/master.d/reactor.conf new file mode 100644 index 0000000..d57d388 --- /dev/null +++ b/salt/files/default/master.d/reactor.conf @@ -0,0 +1,4 @@ +######################################################################## +## File managed by Salt. +## Your changes will be overwritten. +######################################################################## diff --git a/salt/master.sls b/salt/master.sls index d20c0b8..4a23cca 100644 --- a/salt/master.sls +++ b/salt/master.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 %} salt-master: {% if salt_settings.install_packages %} @@ -14,8 +16,16 @@ salt-master: {% endif %} file.recurse: - name: {{ salt_settings.config_path }}/master.d + {%- if salt_settings.master_config_use_TOFS %} + - template: '' + - source: {{ files_switch(['master.d'], + lookup='salt-master' + ) + }} + {%- else %} - template: jinja - source: salt://{{ slspath }}/files/master.d + {%- endif %} - clean: {{ salt_settings.clean_config_d_dir }} - exclude_pat: _* service.running: