Commit fd0c4951 authored by Alain Takoudjou's avatar Alain Takoudjou

vm-bootstrap plabook: sleep before start rerun script, periodicity can be defined

parent 85c8f0e0
......@@ -2,9 +2,14 @@
- name: Add startup script
template: src=start-script.j2 dest=/usr/local/bin/vm-bootstrap-update mode=755
- name: get periodicity time
shell: cat /etc/opt/periodicity || echo 10
register: periodicity
ignore_errors: True
- name: Add a periodical update on the VM
cron: name="Update vm bootstrap"
minute="*/12"
minute="*/{{ periodicity.stdout }}"
job="bash -lc /usr/local/bin/vm-bootstrap-update >> /var/log/vm-bootstrap.log"
cron_file=ansible-vm-bootstrap user="root"
......
......@@ -4,6 +4,6 @@
- name: Add a periodical upload of logs and result
cron: name="Upload ansible files to http server"
minute="*/7"
minute="*/5"
job="/usr/local/bin/ansible-upload-vm-logs http://10.0.2.100/ /var/log/vm-bootstrap.log > /var/log/ansible-upload.log"
cron_file=ansible-upload-log user="root"
......@@ -2,5 +2,8 @@
# Reruns the ansible playbook, does nothing else
cd /opt/slapos.playbook
WAIT_TIME=$((1 + RANDOM % 300))
echo "Sleeping for $WAIT_TIME seconds..."
sleep $WAIT_TIME
ansible-playbook {{ startup_playbook_id }} -i hosts --connection=local
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment