Commit ecedc562 authored by Joanne Hugé's avatar Joanne Hugé

playbook/ors: run playbook once per day until it succeeds

parent 6bc7c003
Pipeline #29929 failed with stage
in 0 seconds
......@@ -2,6 +2,11 @@
hosts: 127.0.0.1
connection: local
vars:
- upgrader_playbook: vifib-upgrade.yml
- extra_playbook: ors.yml
- repeat_until_success: True
vars_files:
- settings/vifib.yml
- settings/slapos-master.yml
......
---
dependencies:
- { role: package, package_name: anacron, package_state: present }
- { role: package, package_name: patchelf, package_state: present }
- { role: package, package_name: util-linux, package_state: present }
- { role: package, package_name: grub-efi-amd64-signed, package_state: present }
......@@ -2,32 +2,20 @@
# Delete ors-upgrade.yml cron which is replaced by ors.yml
- name: Check if ors-upgrade playbook is installed
shell: 'crontab -l | grep -q ors-upgrade'
ignore_errors: yes
register: ors_upgrade_cron
- name: Delete ors-upgrade cron
- name: Remove obsolete cron
cron: name="Launch Upgrader with ansible" state=absent
when: ors_upgrade_cron.rc == 0
- name: Check if vifib playbook is installed
shell: 'crontab -l | grep -A1 "#Ansible: Launch Upgrader with ansible" | grep -v ors-upgrade | grep -q "^*/10.*upgrader"'
ignore_errors: yes
register: vifib_cron
- name: Remove obsolete cron
cron: name="Launch Startup with ansible" state=absent
- name: Install vifib-base playbook
shell: ansible-playbook vifib-base.yml --extra-vars '{"period_minute":"*/10", "period_hour":"*"}'
when: vifib_cron.rc != 0
- name: Remove obsolete cron
cron: name="Launch ors playbook periodically" state=absent
- name: Remove old cron
cron: name="Launch ors playbook every 3 hours" state=absent
- name: Remove obsolete cron
cron: name="Launch ors playbook at reboot" state=absent
- name: Install periodic cron
cron: name="Launch ors playbook periodically" minute="*/10" hour="*" job='sleep 10 && flock -w 300 /opt/upgrader/ansible.lock -c "cd /opt/upgrader/playbook && PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin ansible-playbook ors.yml -i hosts 2>> /opt/upgrader/latest_ors.log >> /opt/upgrader/latest_ors.log"'
- name: Install reboot cron
cron: name="Launch ors playbook at reboot" special_time=reboot job='sleep 10 && flock -w 300 /opt/upgrader/ansible.lock -c "cd /opt/upgrader/playbook && PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin ansible-playbook ors.yml -i hosts 2>> /opt/upgrader/startup_ors.log >> /opt/upgrader/startup_ors.log"'
- name: Remove obsolete cron
cron: name="Launch ors playbook every 3 hours" state=absent
- name: Enable and start cron.service
systemd: name=cron.service enabled=yes state=started
......@@ -160,3 +148,7 @@
jump: SNAT
source_port: 5353
to_source: ':53'
- name: Install upgrader
shell: ansible-playbook upgrader-run.yml --extra-vars 'extra_playbook={{ extra_playbook }} upgrader_playbook={{ upgrader_playbook }} repeat_until_success={{ repeat_until_success }} upgrade_kernel={{ upgrade_kernel | default(False) == True }}' -i hosts 2>>/opt/upgrader/latest_daily_upgrade.log >> /opt/upgrader/latest_daily_upgrade.log
when: launch_upgrader
---
install_folder: "/opt/amarisoft"
amarisoft_version: "2023-06-10"
launch_upgrader: True
572976325d64d618608d19c42dc6e2879086da332887672fc6a7f42c640e2472 -
ee08d5e3709ea1f504946fa5665cc01586503cd126aebdf171e160879b37be79 -
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