diff --git a/cookbooks/aws-parallelcluster-slurm/resources/munge_key_manager.rb b/cookbooks/aws-parallelcluster-slurm/resources/munge_key_manager.rb index daebf1846..4f4ad6118 100644 --- a/cookbooks/aws-parallelcluster-slurm/resources/munge_key_manager.rb +++ b/cookbooks/aws-parallelcluster-slurm/resources/munge_key_manager.rb @@ -62,6 +62,10 @@ def generate_munge_key cwd '/tmp' code <<-GENERATE_KEY set -e + # If the /etc/munge/munge.key already exists, the /usr/sbin/mungekey --verbose command will report an error + if [ -f /etc/munge/munge.key ]; then + rm -f /etc/munge/munge.key + fi /usr/sbin/mungekey --verbose chown #{node['cluster']['munge']['user']}:#{node['cluster']['munge']['group']} /etc/munge/munge.key chmod 0600 /etc/munge/munge.key