From 246161018cb7a63d30af8ff258b8f9de0786fec5 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Fri, 18 Jul 2025 14:17:38 -0400 Subject: [PATCH 1/5] upgrade and start salt process change --- salt/salt/minion.sls | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/salt/salt/minion.sls b/salt/salt/minion.sls index 3ae7ded9a..4dfa54391 100644 --- a/salt/salt/minion.sls +++ b/salt/salt/minion.sls @@ -38,25 +38,33 @@ unhold_salt_packages: {% endfor %} install_salt_minion: + cmd.run: + - name: /bin/sh -c '{{ UPGRADECOMMAND }}' + +# minion service is in failed state after upgrade. this command will start it after the state run for the upgrade completes +start_minion: cmd.run: - name: | exec 0>&- # close stdin exec 1>&- # close stdout exec 2>&- # close stderr - nohup /bin/sh -c '{{ UPGRADECOMMAND }}' & + nohup /bin/sh -c 'sleep 30; systemctl start salt-minion' & + - require: + - cmd: install_salt_minion + - watch: + - cmd: install_salt_minion + - order: last {% endif %} {% if INSTALLEDSALTVERSION|string == SALTVERSION|string %} -# only hold the package if it is already installed + hold_salt_packages: pkg.held: - pkgs: -{% for package in SALTPACKAGES %} -{% if salt['pkg.version'](package) %} +{% for package in SALTPACKAGES %} - {{ package }}: {{SALTVERSION}}-0.* -{% endif %} -{% endfor %} +{% endfor %} remove_error_log_level_logfile: file.line: From beda0bc89ce04d6a6f18cf76b47592e01ec836a8 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Mon, 21 Jul 2025 15:40:36 -0400 Subject: [PATCH 2/5] new state name. no longer need to close stdin, stderr stdout --- salt/salt/minion.sls | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/salt/salt/minion.sls b/salt/salt/minion.sls index 4dfa54391..ba1613b82 100644 --- a/salt/salt/minion.sls +++ b/salt/salt/minion.sls @@ -42,13 +42,9 @@ install_salt_minion: - name: /bin/sh -c '{{ UPGRADECOMMAND }}' # minion service is in failed state after upgrade. this command will start it after the state run for the upgrade completes -start_minion: +start_minion_post_upgrade: cmd.run: - - name: | - exec 0>&- # close stdin - exec 1>&- # close stdout - exec 2>&- # close stderr - nohup /bin/sh -c 'sleep 30; systemctl start salt-minion' & + - name: nohup /bin/sh -c 'sleep 30; systemctl start salt-minion' & - require: - cmd: install_salt_minion - watch: From 442aecb9f47adbc1e792d258642997ce8c221f38 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Tue, 22 Jul 2025 10:30:59 -0400 Subject: [PATCH 3/5] bootstrap dont start daemon, use state to start it --- salt/salt/map.jinja | 4 ++-- salt/salt/minion.sls | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/salt/salt/map.jinja b/salt/salt/map.jinja index 55b3a7ffb..1e3b200f4 100644 --- a/salt/salt/map.jinja +++ b/salt/salt/map.jinja @@ -26,9 +26,9 @@ {% if INSTALLEDSALTVERSION != SALTVERSION %} {% if grains.os_family|lower == 'redhat' %} - {% set UPGRADECOMMAND = 'yum clean all ; /usr/sbin/bootstrap-salt.sh -s 120 -r -F stable ' ~ SALTVERSION %} + {% set UPGRADECOMMAND = 'yum clean all ; /usr/sbin/bootstrap-salt.sh -X -r -F stable ' ~ SALTVERSION %} {% elif grains.os_family|lower == 'debian' %} - {% set UPGRADECOMMAND = '/usr/sbin/bootstrap-salt.sh -s 120 -F stable ' ~ SALTVERSION %} + {% set UPGRADECOMMAND = '/usr/sbin/bootstrap-salt.sh -X -F stable ' ~ SALTVERSION %} {% endif %} {% else %} {% set UPGRADECOMMAND = 'echo Already running Salt Minion version ' ~ SALTVERSION %} diff --git a/salt/salt/minion.sls b/salt/salt/minion.sls index ba1613b82..8736f4eb2 100644 --- a/salt/salt/minion.sls +++ b/salt/salt/minion.sls @@ -44,7 +44,11 @@ install_salt_minion: # minion service is in failed state after upgrade. this command will start it after the state run for the upgrade completes start_minion_post_upgrade: cmd.run: - - name: nohup /bin/sh -c 'sleep 30; systemctl start salt-minion' & + - name: | + exec 0>&- # close stdin + exec 1>&- # close stdout + exec 2>&- # close stderr + nohup /bin/sh -c 'sleep 30; systemctl start salt-minion' & - require: - cmd: install_salt_minion - watch: From 669d219fdc6e30eeddd648d676119b5edeb1ac48 Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Tue, 22 Jul 2025 11:52:50 -0400 Subject: [PATCH 4/5] splay highstate schedule 2minutes for non managers --- salt/schedule.sls | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/salt/schedule.sls b/salt/schedule.sls index 74c9acb56..c3b5d85ae 100644 --- a/salt/schedule.sls +++ b/salt/schedule.sls @@ -1,5 +1,10 @@ +{% from 'vars/globals.map.jinja' import GLOBALS %} + highstate_schedule: schedule.present: - function: state.highstate - minutes: 15 - maxrunning: 1 +{% if not GLOBALS.is_manager %} + - splay: 120 +{% endif %} From af49a8e4ef72f4b9a6c9bfa376c14bddc71e151d Mon Sep 17 00:00:00 2001 From: Josh Patterson Date: Tue, 22 Jul 2025 13:22:50 -0400 Subject: [PATCH 5/5] add back comment --- salt/salt/minion.sls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/salt/salt/minion.sls b/salt/salt/minion.sls index 8736f4eb2..b6db9d046 100644 --- a/salt/salt/minion.sls +++ b/salt/salt/minion.sls @@ -58,7 +58,7 @@ start_minion_post_upgrade: {% endif %} {% if INSTALLEDSALTVERSION|string == SALTVERSION|string %} - +# only hold the package if it is already installed hold_salt_packages: pkg.held: - pkgs: