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

roles/upgrader: wait until machine has internet to execute playbook

parent 21ba67a0
Pipeline #33609 passed with stage
in 0 seconds
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
when: extra_playbook == "ors.yml" when: extra_playbook == "ors.yml"
- name: Set Cron to repeat until success - name: Set Cron to repeat until success
cron: name="Repeat until success" minute="*/5" hour="*" job="curl -fIs $(grep "^deb" /etc/apt/sources.list| cut -f2 -d' ' | head -n1) && flock -n /opt/upgrader/ansible.lock -c \"cd /opt/upgrader/playbook && PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 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 }} playbook_report={{ playbook_report_fact }}' -i hosts 2>>/opt/upgrader/latest_repeat_upgrade.log >> /opt/upgrader/latest_repeat_upgrade.log\"" cron: name="Repeat until success" minute="*/5" hour="*" job="while ! curl -fIs $(grep "^deb" /etc/apt/sources.list| cut -f2 -d' ' | head -n1) ; do sleep 1 ; done ; flock -n /opt/upgrader/ansible.lock -c \"cd /opt/upgrader/playbook && PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 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 }} playbook_report={{ playbook_report_fact }}' -i hosts 2>>/opt/upgrader/latest_repeat_upgrade.log >> /opt/upgrader/latest_repeat_upgrade.log\""
when: repeat_until_success | bool when: repeat_until_success | bool
- name: Get monitor private directory path - name: Get monitor private directory path
...@@ -177,5 +177,5 @@ ...@@ -177,5 +177,5 @@
when: repeat_until_success | bool when: repeat_until_success | bool
- name: Set Anacron after successful playbook run - name: Set Anacron after successful playbook run
lineinfile: dest=/etc/anacrontab regexp="^[0-9]+ [0-9]+ extra.playbook (.*)" line="1 10 extra.playbook curl -fIs $(grep "^deb" /etc/apt/sources.list| cut -f2 -d' ' | head -n1) && flock -n /opt/upgrader/ansible.lock -c \"[ -d /opt/upgrader/playbook-tmp ] && { rm -rf /opt/upgrader/playbook ; mv /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 'extra_playbook={{ extra_playbook }} upgrader_playbook={{ upgrader_playbook }} repeat_until_success={{ repeat_until_success }} upgrade_kernel={{ upgrade_kernel | default(False) == True }} playbook_report={{ playbook_report_fact }}' -i hosts 2>>/opt/upgrader/latest_daily_upgrade.log >> /opt/upgrader/latest_daily_upgrade.log\"" state=present lineinfile: dest=/etc/anacrontab regexp="^[0-9]+ [0-9]+ extra.playbook (.*)" line="1 10 extra.playbook while ! curl -fIs $(grep "^deb" /etc/apt/sources.list| cut -f2 -d' ' | head -n1) ; do sleep 1 ; done ; flock -n /opt/upgrader/ansible.lock -c \"[ -d /opt/upgrader/playbook-tmp ] && { rm -rf /opt/upgrader/playbook ; mv /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 'extra_playbook={{ extra_playbook }} upgrader_playbook={{ upgrader_playbook }} repeat_until_success={{ repeat_until_success }} upgrade_kernel={{ upgrade_kernel | default(False) == True }} playbook_report={{ playbook_report_fact }}' -i hosts 2>>/opt/upgrader/latest_daily_upgrade.log >> /opt/upgrader/latest_daily_upgrade.log\"" state=present
when: repeat_until_success | bool when: repeat_until_success | bool
d5a847c46b8beab02b28f0284234a274112d92e007fd1afc4eb86c22cd68816e - 6f72502c6a9f517136c9763b9316f0dacf48176d8378f54734713c6d2259f148 -
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