From 1b611c871e17ec402c166ec352872c8b8c502837 Mon Sep 17 00:00:00 2001 From: Rene Jochum Date: Thu, 14 Jul 2016 18:23:08 +0200 Subject: [PATCH] Add optional method to remove /etc/salt/minion. Signed-off-by: Rene Jochum --- pillar.example | 7 +++++-- salt/defaults.yaml | 2 ++ salt/minion.sls | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pillar.example b/pillar.example index 6d3058d..3033bef 100644 --- a/pillar.example +++ b/pillar.example @@ -4,6 +4,9 @@ salt: # and up as it'll wipe out important files that Salt relies on. clean_config_d_dir: False + # This state will remove "/etc/salt/minion" when you set this to true. + minion_remove_config: True + # Set this to False to not have the formula install packages (in the case you # install Salt via git/pip/etc.) install_packages: True @@ -129,7 +132,7 @@ salt: # salt cloud config cloud: master: salt - + # For non-templated custom cloud provider/profile/map files providers: provider-filename1.conf: @@ -158,7 +161,7 @@ salt: map-filename1.map: server-non-prod: - host.mycompany.com: - grains: + grains: environment: dev1 # You can take profile and map templates from an alternate location diff --git a/salt/defaults.yaml b/salt/defaults.yaml index 1a7fa7a..1cbb3f1 100644 --- a/salt/defaults.yaml +++ b/salt/defaults.yaml @@ -6,6 +6,8 @@ salt: config_path: /etc/salt + minion_remove_config: False + minion_service: salt-minion master_service: salt-master api_service: salt-api diff --git a/salt/minion.sls b/salt/minion.sls index 2097abe..9d141b7 100644 --- a/salt/minion.sls +++ b/salt/minion.sls @@ -23,6 +23,12 @@ salt-minion: - file: salt-minion - file: remove-old-minion-conf-file +{% if salt_settings.minion_remove_config %} +remove-default-minion-conf-file: + file.absent: + - name: {{ salt_settings.config_path }}/minion +{% endif %} + # clean up old _defaults.conf file if they have it around remove-old-minion-conf-file: file.absent: