Skip to content
Snippets Groups Projects
Commit e5cbdaab authored by Simon Michnowicz's avatar Simon Michnowicz
Browse files

file that deletes old job is now unique to cluster, so that M3 and Monarch can have different files

Former-commit-id: c7922090
parent 3af04f3f
No related branches found
No related tags found
No related merge requests found
...@@ -57,11 +57,16 @@ ...@@ -57,11 +57,16 @@
# #
# template delete file to localhost.then copy to remote host # template delete file to localhost.then copy to remote host
# #
- name: make a unique name for the backup script
set_fact:
unique_name: "delete_old_mysql_bk_{{ SQL_BK_DEST_DIR | basename }}.sh"
- name: Unique filename is
debug: var=unique_name
- name: delete local del file - name: delete local del file
local_action: command rm -f ./delete_old_mysql_bk.sh local_action: command rm -f ./{{ unique_name }}
- name: template delete script to local dir - name: template delete script to local dir
local_action: template src=delete_old_mysql_bk.sh.j2 dest=./delete_old_mysql_bk.sh local_action: template src=delete_old_mysql_bk.sh.j2 dest=./{{ unique_name }}
- name: copy backup script to server ec2-user@{{ SQL_BK_DEST_HOST }} - name: copy backup script to server ec2-user@{{ SQL_BK_DEST_HOST }}
local_action: command scp -i ./slm_db_backup ./delete_old_mysql_bk.sh "ec2-user@{{ SQL_BK_DEST_HOST }}:" local_action: command scp -i ./slm_db_backup ./{{ unique_name }} "ec2-user@{{ SQL_BK_DEST_HOST }}:"
- name: insert delete cron job entry on remote server - name: insert delete cron job entry on remote server
local_action: command ssh -i ./slm_db_backup ec2-user@{{ SQL_BK_DEST_HOST }} "{ crontab -l ; echo '#delete old slurm backups' ; echo '00 23 * * * /home/ec2-user/delete_old_mysql_bk.sh' ; } | crontab - " local_action: command ssh -i ./slm_db_backup ec2-user@{{ SQL_BK_DEST_HOST }} "{ crontab -l ; echo '#delete old slurm backups' ; echo '00 23 * * * /home/ec2-user/{{ unique_name }}' ; } | crontab - "
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment