Cleanup outdated salt keys 05/39805/1
authorMichael Polenchuk <mpolenchuk@mirantis.com>
Mon, 21 Aug 2017 16:36:14 +0000 (20:36 +0400)
committerMichael Polenchuk <mpolenchuk@mirantis.com>
Mon, 21 Aug 2017 16:40:57 +0000 (20:40 +0400)
Remove keys that are left over from the previous deployment
to avoid interfere with the new ones.

Change-Id: I0dfa9782cbce9a8e8b7c1efe5954c8ffe85996f9
Signed-off-by: Michael Polenchuk <mpolenchuk@mirantis.com>
mcp/config/states/maas

index 0c01617..73deb48 100755 (executable)
@@ -29,6 +29,9 @@ salt -C 'mas01*' state.apply maas.machines
 wait_for "salt 'mas01*' --out yaml state.apply maas.machines.status | " \
          "tee /dev/stderr | fgrep -q 'Ready: 5'"
 
+# cleanup outdated salt keys
+salt-key --out yaml | awk '!/^(minions|- cfg01|- mas01)/ {print $2}' | xargs -I{} salt-key -yd {}
+
 # MaaS node deployment
 salt -C 'mas01*' state.apply maas.machines.deploy
 wait_for "salt 'mas01*' --out yaml state.apply maas.machines.status | " \