Skip to content

Commit fbe814a

Browse files
committed
feat(tofs): allow TOFS for minion configuration
1 parent 1b202af commit fbe814a

File tree

7 files changed

+33
-3
lines changed

7 files changed

+33
-3
lines changed

pillar.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ salt:
6767
# source_files:
6868
# salt-master:
6969
# - 'alt_master.d'
70+
# salt-minion:
71+
# - 'alt_minion.d'
7072

7173
# salt master config
7274
master_config_use_TOFS: True
@@ -150,6 +152,7 @@ salt:
150152
- /srv/salt/reactors/deploy.sls
151153

152154
# salt minion config:
155+
minion_config_use_TOFS: True
153156
minion:
154157

155158
# single master setup

salt/defaults.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ salt:
1010

1111
minion_remove_config: False
1212
master_remove_config: False
13+
minion_config_use_TOFS: False
1314
master_config_use_TOFS: False
1415

1516
minion_service: salt-minion
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
########################################################################
2+
## File managed by Salt.
3+
## Your changes will be overwritten.
4+
########################################################################
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
########################################################################
2+
## File managed by Salt.
3+
## Your changes will be overwritten.
4+
########################################################################
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
########################################################################
2+
## File managed by Salt.
3+
## Your changes will be overwritten.
4+
########################################################################
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
########################################################################
2+
## File managed by Salt.
3+
## Your changes will be overwritten.
4+
########################################################################

salt/minion.sls

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
{% from "salt/map.jinja" import salt_settings with context %}
1+
{%- set tplroot = tpldir.split('/')[0] %}
2+
{%- from tplroot ~ "/map.jinja" import salt_settings with context %}
3+
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
24
35
{% if salt_settings.install_packages and grains.os == 'MacOS' and salt_settings.salt_minion_pkg_source != '' and salt_settings.version != '' %}
46
{# 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:
4547
{% endif %}
4648
file.recurse:
4749
- name: {{ salt_settings.config_path }}/minion.d
50+
{%- if salt_settings.minion_config_use_TOFS %}
51+
- template: ''
52+
- source: {{ files_switch(['minion.d'],
53+
lookup='salt-minion'
54+
)
55+
}}
56+
{%- else %}
4857
- template: jinja
4958
- source: salt://{{ slspath }}/files/minion.d
50-
- clean: {{ salt_settings.clean_config_d_dir }}
51-
- exclude_pat: _*
5259
- context:
5360
standalone: False
61+
{%- endif %}
62+
- clean: {{ salt_settings.clean_config_d_dir }}
63+
- exclude_pat: _*
5464
service.running:
5565
- enable: True
5666
- name: {{ salt_settings.minion_service }}

0 commit comments

Comments
 (0)