Long running task

When using ansible provisioning, I have a task which takes a long time. 6 hours to be exact. Obviously, my AWS token expires after 1 hour. Is there a way to run a script before each packer call? Ideally, I would like to update my

AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY

variables after each packer call.

I use aws cli to generate these variables.

1 Like