Commit 90e709db authored by Rafael Monnerat's avatar Rafael Monnerat

playbook: Fix startup for wendelin/erp5 standalone

  - Use crontab instead rc.local for start up
  - Include log on the run
  - Make script retry in case of failure (ie.: Network is not ready yet)
  - Pass PATH variable for slapos format, on cron it cannot find few binaries
parent dbf293db
......@@ -23,7 +23,7 @@
ignore_errors: True
- name: Run slapos format for initial bootstrap
shell: "slapos node format --now --alter_user=True"
shell: "PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/slapos/bin slapos node format --now --alter_user=True"
- name: Set ownership for /opt/slapgrid
shell: "chown slapsoft:slapsoft /opt/slapgrid"
......
......@@ -11,11 +11,8 @@
- name: Add startup script
template: src=start-script.j2 dest=/usr/local/bin/{{ playbook_name }}-startup mode=755
- name: Add to rc.local
lineinfile:
dest=/etc/rc.local insertbefore=BOF
line='bash /usr/local/bin/{{ playbook_name }}-startup &'
state=present
- name: Include on reboot
cron: name="Start Up script" special_time=reboot job="/usr/local/bin/{{ playbook_name }}-startup >> /var/log/{{ playbook_name }}-startup.log 2>&1"
- name: Get slapos.playbook directory name
shell: cd /tmp/tmpplaybookerp5-standalone.*/slapos.playbook.git/playbook/; echo $(pwd)/
......
......@@ -3,4 +3,13 @@
cd /opt/slapos.playbook/
ansible-playbook {{ startup_playbook_id }} -i hosts --connection=local
export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
for i in `seq 1 10`; do
echo "Try $i"
ansible-playbook {{ startup_playbook_id }} -i hosts --connection=local
if [ "$?" == 0 ]; then
exit 0
fi
sleep 30
done
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