Add alternative playbook scheduler for ORS
I would like to add an alternative playbook scheduler for ORS. Currently in upgrader and vifib-server playbook we simple install a period cron ever X minutes. Instead for ORS I propose the following:
- At beginning of playbook install a cron job scheduled to run upgrader playbook every 5 minutes
- If playbook fails then it will run again every 5 minutes
- At the end of playbook remove the cron job every 5 minutes and add a anacron job scheduled to run once a day
This will satisfy the three requirements of playbook for ORS:
- run playbook as few times as possible to avoid performance issues
- quickly upgrade when clients power on their ORS (clients leave their ORS off for long period of times and only power on to update, they want it to be quick and not take hours)
- be resilient to unexpected playbook failures (which can happen because client sometimes have environment where internet is not always available)
I also add a curl before executing playbook to make sure we are connected to internet, otherwise playbook would run every 5 minutes when ORS is disconnected from internet (which happens often). I used url from /etc/apt/source.list because if I use website such as google.com I'm not sure it will work in country such as china, and the goal of the playbook is to update OS packages anyway.