Skip to content

feat(config): support emptying config #568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pillar.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,15 @@ salt:
# This state will remove "/etc/salt/minion" when you set this to true.
minion_remove_config: true

# /etc/salt/minion will be emptied if you set this to true.
minion_empty_config: true

# This state will remove "/etc/salt/master" when you set this to true.
master_remove_config: true

# /etc/salt/master will be emptied if you set this to true.
master_empty_config: true

# Set this to 'py3' to install the Python 3 packages.
# The default varies between OS versions.
py_ver: 'py3'
Expand Down
2 changes: 2 additions & 0 deletions salt/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ salt:
config_path: /etc/salt

minion_remove_config: false
minion_empty_config: false
master_remove_config: false
master_empty_config: false
minion_config_use_TOFS: false
master_config_use_TOFS: false

Expand Down
6 changes: 6 additions & 0 deletions salt/master.sls
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ remove-default-master-conf-file:
- name: {{ salt_settings.config_path }}/master
- watch_in:
- service: salt-master
{% elif salt_settings.master_empty_config %}
empty-default-master-conf-file:
file.managed:
- name: {{ salt_settings.config_path }}/master
- contents: |
# Configuration is managed by Salt
{% endif %}

# clean up old _defaults.conf file if they have it around
Expand Down
6 changes: 6 additions & 0 deletions salt/minion.sls
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ salt-minion-beacon-inotify:
remove-default-minion-conf-file:
file.absent:
- name: {{ salt_settings.config_path }}/minion
{% elif salt_settings.minion_empty_config %}
empty-default-minion-conf-file:
file.managed:
- name: {{ salt_settings.config_path }}/master
- contents: |
# Configuration is managed by Salt
{% endif %}

# clean up old _defaults.conf file if they have it around
Expand Down
Loading