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

playbook: add flock mechanism to vifib and ors playbooks

both playbooks need to run frequently on ORS which caused conflicts
parent ff4896ca
Pipeline #24196 failed with stage
--- ---
dependencies: dependencies:
- { role: package, package_name: patchelf, package_state: present } - { role: package, package_name: patchelf, package_state: present }
- { role: package, package_name: util-linux, package_state: present }
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
cron: name="Launch ors playbook every 3 hours" state=absent cron: name="Launch ors playbook every 3 hours" state=absent
- name: Install periodic cron - name: Install periodic cron
cron: name="Launch ors playbook periodically" minute="*/10" hour="*" job='sleep 240 && 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' 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 - name: Install reboot cron
cron: name="Launch ors playbook at reboot" special_time=reboot job='sleep 30 && 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' 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: Install rm-tmp-lte script - name: Install rm-tmp-lte script
copy: src=rm-tmp-lte dest={{ install_folder }} owner=root mode=770 copy: src=rm-tmp-lte dest={{ install_folder }} owner=root mode=770
......
--- ---
dependencies: dependencies:
- { role: slapcache } - { role: slapcache }
- { role: package, package_name: util-linux, package_state: present }
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
chdir: /opt/upgrader/playbook-tmp/ chdir: /opt/upgrader/playbook-tmp/
- name: Set Cron - name: Set Cron
cron: name="Launch Upgrader with ansible" minute="{{ period_minute }}" hour="{{ period_hour }}" job='rm -rf /opt/upgrader/playbook && cp -R /opt/upgrader/playbook-tmp /opt/upgrader/playbook && cd /opt/upgrader/playbook && PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin ansible-playbook upgrader-run.yml --extra-vars "period_minute={{ period_minute }} period_hour={{ period_hour }} upgrader_playbook={{ upgrader_playbook }} upgrade_kernel={{ upgrade_kernel | default(False) == True }}" -i hosts 2>>/opt/upgrader/latest_upgrade.log >> /opt/upgrader/latest_upgrade.log' cron: name="Launch Upgrader with ansible" minute="{{ period_minute }}" hour="{{ period_hour }}" job="flock -n /opt/upgrader/ansible.lock -c \"rm -rf /opt/upgrader/playbook && cp -R /opt/upgrader/playbook-tmp /opt/upgrader/playbook && cd /opt/upgrader/playbook && PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin ansible-playbook upgrader-run.yml --extra-vars 'period_minute={{ period_minute }} period_hour={{ period_hour }} upgrader_playbook={{ upgrader_playbook }} upgrade_kernel={{ upgrade_kernel | default(False) == True }}' -i hosts 2>>/opt/upgrader/latest_upgrade.log >> /opt/upgrader/latest_upgrade.log\""
- cron: name="Launch Upgrader" state=absent - cron: name="Launch Upgrader" state=absent
......
---
dependencies:
- { role: package, package_name: util-linux, package_state: present }
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
copy: src="slapos_limit.conf" dest="/etc/security/limits.d/slapos.conf" mode=0644 owner=root group=root copy: src="slapos_limit.conf" dest="/etc/security/limits.d/slapos.conf" mode=0644 owner=root group=root
- name: Set Cron - name: Set Cron
cron: name="Launch Startup with ansible" special_time=reboot job='cd /opt/upgrader/playbook && ansible-playbook vifib-startup.yml -i hosts 2>>/opt/upgrader/startup.log >> /opt/upgrader/startup.log' cron: name="Launch Startup with ansible" special_time=reboot job='flock /opt/upgrader/ansible.lock -c "cd /opt/upgrader/playbook && ansible-playbook vifib-startup.yml -i hosts 2>>/opt/upgrader/startup.log >> /opt/upgrader/startup.log"'
- name: Get systemd version - name: Get systemd version
shell: systemd --version | head -n 1 | cut -d " " -f 2 shell: systemd --version | head -n 1 | cut -d " " -f 2
......
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