Commit 4111dd09 authored by Joanne Hugé's avatar Joanne Hugé

playbook: ignore errors for playbook reporting

parent e96ae8e9
Pipeline #30608 failed with stage
in 0 seconds
...@@ -6,11 +6,12 @@ ...@@ -6,11 +6,12 @@
- name: Get monitor private directory path - name: Get monitor private directory path
shell: 'realpath $(dirname $(grep -lR "software_release_url = .*software/monitor/software.cfg" $(find /srv/slapgrid -type f -name "buildout.cfg")))/srv/monitor/private' shell: 'realpath $(dirname $(grep -lR "software_release_url = .*software/monitor/software.cfg" $(find /srv/slapgrid -type f -name "buildout.cfg")))/srv/monitor/private'
register: monitor_path register: monitor_path
when: playbook_report | bool when: (monitor_path is succeeded) and (playbook_report | bool)
ignore_errors: yes
- name: Create directory if it does not exist - name: Create directory if it does not exist
file: path="{{ monitor_path.stdout }}/playbook-report" state=directory mode=0755 file: path="{{ monitor_path.stdout }}/playbook-report" state=directory mode=0755
when: playbook_report | bool when: (monitor_path is succeeded) and (playbook_report | bool)
- name: Check Amarisoft version - name: Check Amarisoft version
shell: 'find /opt/amarisoft -maxdepth 1 | grep "^/opt/amarisoft/v[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}$" | cut -d/ -f4 | sort | tail -n1' shell: 'find /opt/amarisoft -maxdepth 1 | grep "^/opt/amarisoft/v[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}$" | cut -d/ -f4 | sort | tail -n1'
...@@ -32,11 +33,11 @@ ...@@ -32,11 +33,11 @@
template: template:
src: playbook-report.j2 src: playbook-report.j2
dest: /tmp/playbook-report-tmp.log dest: /tmp/playbook-report-tmp.log
when: playbook_report | bool when: (monitor_path is succeeded) and (playbook_report | bool)
- name: Append to log - name: Append to log
shell: 'cat /tmp/playbook-report-tmp.log >> {{ monitor_path.stdout }}/playbook-report/report.log' shell: 'cat /tmp/playbook-report-tmp.log >> {{ monitor_path.stdout }}/playbook-report/report.log'
when: (playbook_report | bool) and (extra_playbook | length > 0) when: (monitor_path is succeeded) and (playbook_report | bool) and (extra_playbook | length > 0)
# SSD image backports # SSD image backports
......
...@@ -7,10 +7,11 @@ ...@@ -7,10 +7,11 @@
shell: 'realpath $(dirname $(grep -lR "software_release_url = .*software/monitor/software.cfg" $(find /srv/slapgrid -type f -name "buildout.cfg")))/srv/monitor/private' shell: 'realpath $(dirname $(grep -lR "software_release_url = .*software/monitor/software.cfg" $(find /srv/slapgrid -type f -name "buildout.cfg")))/srv/monitor/private'
register: monitor_path register: monitor_path
when: playbook_report | bool when: playbook_report | bool
ignore_errors: yes
- name: Create directory if it does not exist - name: Create directory if it does not exist
file: path="{{ monitor_path.stdout }}/playbook-report" state=directory mode=0755 file: path="{{ monitor_path.stdout }}/playbook-report" state=directory mode=0755
when: playbook_report | bool when: (monitor_path is succeeded) and (playbook_report | bool)
- name: Setting playbook report message - name: Setting playbook report message
set_fact: playbook_report_message="Starting upgrader playbook" playbook_report_progress="0" set_fact: playbook_report_message="Starting upgrader playbook" playbook_report_progress="0"
...@@ -19,11 +20,11 @@ ...@@ -19,11 +20,11 @@
template: template:
src: playbook-report.j2 src: playbook-report.j2
dest: /tmp/playbook-report-tmp.log dest: /tmp/playbook-report-tmp.log
when: playbook_report | bool when: (monitor_path is succeeded) and (playbook_report | bool)
- name: Append to log - name: Append to log
shell: 'cat /tmp/playbook-report-tmp.log >> {{ monitor_path.stdout }}/playbook-report/report.log' shell: 'cat /tmp/playbook-report-tmp.log >> {{ monitor_path.stdout }}/playbook-report/report.log'
when: playbook_report | bool when: (monitor_path is succeeded) and (playbook_report | bool)
- file: path=/opt/upgrader state=directory mode=0755 - file: path=/opt/upgrader state=directory mode=0755
...@@ -96,11 +97,11 @@ ...@@ -96,11 +97,11 @@
template: template:
src: playbook-report.j2 src: playbook-report.j2
dest: /tmp/playbook-report-tmp.log dest: /tmp/playbook-report-tmp.log
when: playbook_report | bool when: (monitor_path is succeeded) and (playbook_report | bool)
- name: Append to log - name: Append to log
shell: 'cat /tmp/playbook-report-tmp.log >> {{ monitor_path.stdout }}/playbook-report/report.log' shell: 'cat /tmp/playbook-report-tmp.log >> {{ monitor_path.stdout }}/playbook-report/report.log'
when: (playbook_report | bool) and (lookup('file', '/opt/upgrader/playbook-tmp/upgrade_after')|int > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature')) when: (monitor_path is succeeded) and (playbook_report | bool) and (lookup('file', '/opt/upgrader/playbook-tmp/upgrade_after')|int > lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature'))
- name: Do upgrade - name: Do upgrade
shell: ansible-playbook {{ upgrader_playbook }} --extra-vars 'repeat_until_success={{ repeat_until_success }}' -i hosts 2>>/opt/upgrader/latest_upgrade.log >> /opt/upgrader/latest_upgrade.log shell: ansible-playbook {{ upgrader_playbook }} --extra-vars 'repeat_until_success={{ repeat_until_success }}' -i hosts 2>>/opt/upgrader/latest_upgrade.log >> /opt/upgrader/latest_upgrade.log
...@@ -115,11 +116,11 @@ ...@@ -115,11 +116,11 @@
template: template:
src: playbook-report.j2 src: playbook-report.j2
dest: /tmp/playbook-report-tmp.log dest: /tmp/playbook-report-tmp.log
when: playbook_report | bool when: (monitor_path is succeeded) and (playbook_report | bool)
- name: Append to log - name: Append to log
shell: 'cat /tmp/playbook-report-tmp.log >> {{ monitor_path.stdout }}/playbook-report/report.log' shell: 'cat /tmp/playbook-report-tmp.log >> {{ monitor_path.stdout }}/playbook-report/report.log'
when: (playbook_report | bool) and (extra_playbook | length > 0) when: (monitor_path is succeeded) and (playbook_report | bool) and (extra_playbook | length > 0)
- name: Do extra playbook - name: Do extra playbook
shell: ansible-playbook {{ extra_playbook }} --extra-vars 'launch_upgrader=False' -i hosts 2>>/opt/upgrader/latest_extra_playbook.log >> /opt/upgrader/latest_extra_playbook.log shell: ansible-playbook {{ extra_playbook }} --extra-vars 'launch_upgrader=False' -i hosts 2>>/opt/upgrader/latest_extra_playbook.log >> /opt/upgrader/latest_extra_playbook.log
...@@ -149,11 +150,11 @@ ...@@ -149,11 +150,11 @@
template: template:
src: playbook-report.j2 src: playbook-report.j2
dest: /tmp/playbook-report-tmp.log dest: /tmp/playbook-report-tmp.log
when: playbook_report | bool when: (monitor_path is succeeded) and (playbook_report | bool)
- name: Append to log - name: Append to log
shell: 'cat /tmp/playbook-report-tmp.log >> {{ monitor_path.stdout }}/playbook-report/report.log' shell: 'cat /tmp/playbook-report-tmp.log >> {{ monitor_path.stdout }}/playbook-report/report.log'
when: playbook_report | bool when: (monitor_path is succeeded) and (playbook_report | bool)
- name: Remove cron after successful playbook run - name: Remove cron after successful playbook run
cron: name="Repeat until success" state=absent cron: name="Repeat until success" state=absent
......
d8d83472b5d13d54e1d2db757e7e054b26a156e49ac569927d00117f5ad8c959 - 5ca83ab7b99e21d42783ba9b7bce25b9cafc125267dd21682b9d622906998df6 -
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