Commit 342527e9 authored by Rafael Monnerat's avatar Rafael Monnerat

obs/slapos: Setup crontab as early as possible for the upgrade.

parent ffdc83d7
...@@ -58,21 +58,23 @@ ...@@ -58,21 +58,23 @@
current_upgrade_signature current_upgrade_signature
- name: Do upgrade - name: Do upgrade
shell: ansible-playbook {{ upgrader_playbook }} -i hosts 2>>/opt/upgrader/latest_upgrade.log >> /opt/upgrader/latest_upgrade.log shell: ansible-playbook {{ upgrader_playbook }} -i hosts 2>>/opt/upgrader/latest_upgrade.log >> /opt/upgrader/latest_upgrade.log
when: (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature')) when: (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature'))
args: args:
chdir: /opt/upgrader/playbook-tmp/ chdir: /opt/upgrader/playbook-tmp/
- name: Set Cron
cron: name="Launch Upgrader with ansible" minute="0" hour="*/3" job='rm -rf /opt/upgrader/playbook && cp -R /opt/upgrader/playbook-tmp /opt/upgrader/playbook && cd /opt/upgrader/playbook && ansible-playbook upgrader-run.yml --extra-vars "upgrader_playbook={{ upgrader_playbook }}" -i hosts 2>>/opt/upgrader/latest_upgrade.log >> /opt/upgrader/latest_upgrade.log'
- cron: name="Launch Upgrader" state=absent
- name: Upgrade Current Upgrade Signature - name: Upgrade Current Upgrade Signature
shell: cat /opt/upgrader/next-upgrade-signature > /opt/upgrader/current-upgrade-signature shell: cat /opt/upgrader/next-upgrade-signature > /opt/upgrader/current-upgrade-signature
when: (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature')) when: (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature'))
- shell: echo {{ ansible_date_time.epoch }} > /opt/upgrader/last-upgrade - shell: echo {{ ansible_date_time.epoch }} > /opt/upgrader/last-upgrade
when: (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int ) when: (upgrade_after > lookup('file', '/opt/upgrader/last-upgrade')|int )
- name: Set Cron
cron: name="Launch Upgrader with ansible" minute="0" hour="*/3" job='rm -rf /opt/upgrader/playbook && cp -R /opt/upgrader/playbook-tmp /opt/upgrader/playbook && cd /opt/upgrader/playbook && ansible-playbook upgrader-run.yml --extra-vars "upgrader_playbook={{ upgrader_playbook }}" -i hosts 2>>/opt/upgrader/latest_upgrade.log >> /opt/upgrader/latest_upgrade.log'
- cron: name="Launch Upgrader" state=absent
- include: remove-legacy.yml - include: remove-legacy.yml
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