Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.package
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Arnaud Véron
slapos.package
Commits
bb1070de
Commit
bb1070de
authored
Sep 29, 2023
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook/bbu: add reporting to monitor SR
parent
574af5ef
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
1 deletion
+66
-1
playbook/bbu.yml
playbook/bbu.yml
+1
-0
playbook/ors.yml
playbook/ors.yml
+1
-0
playbook/roles/upgrader/defaults/main.yml
playbook/roles/upgrader/defaults/main.yml
+1
-0
playbook/roles/upgrader/tasks/main.yml
playbook/roles/upgrader/tasks/main.yml
+61
-0
playbook/roles/upgrader/templates/playbook-report.j2
playbook/roles/upgrader/templates/playbook-report.j2
+1
-0
playbook/sha256sum
playbook/sha256sum
+1
-1
No files found.
playbook/bbu.yml
View file @
bb1070de
...
...
@@ -6,6 +6,7 @@
-
upgrader_playbook
:
vifib-upgrade.yml
-
extra_playbook
:
bbu.yml
-
repeat_until_success
:
True
-
playbook_report
:
True
vars_files
:
-
settings/vifib.yml
...
...
playbook/ors.yml
View file @
bb1070de
...
...
@@ -6,6 +6,7 @@
-
upgrader_playbook
:
vifib-upgrade.yml
-
extra_playbook
:
ors.yml
-
repeat_until_success
:
True
-
playbook_report
:
True
vars_files
:
-
settings/vifib.yml
...
...
playbook/roles/upgrader/defaults/main.yml
View file @
bb1070de
...
...
@@ -2,3 +2,4 @@ period_minute: '0'
period_hour
:
'
*/3'
extra_playbook
:
'
'
repeat_until_success
:
False
playbook_report
:
False
playbook/roles/upgrader/tasks/main.yml
View file @
bb1070de
...
...
@@ -3,6 +3,28 @@
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 \"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 '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_repeat_upgrade.log >> /opt/upgrader/latest_repeat_upgrade.log\""
when
:
repeat_until_success | bool
-
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'
register
:
monitor_path
when
:
playbook_report | bool
-
name
:
Create directory if it does not exist
file
:
path="{{ monitor_path.stdout }}/playbook-report" state=directory mode=0755
when
:
playbook_report | bool
-
name
:
Setting playbook report message
set_fact
:
playbook_report_message="Starting upgrader playbook" playbook_report_progress="0"
-
name
:
Render log template
template
:
src
:
playbook-report.j2
dest
:
/tmp/playbook-report-tmp.log
when
:
playbook_report | bool
-
name
:
Append to log
shell
:
'
cat
/tmp/playbook-report-tmp.log
>>
{{
monitor_path.stdout
}}/playbook-report/report.log'
when
:
playbook_report | bool
-
file
:
path=/opt/upgrader state=directory mode=0755
-
stat
:
path=/opt/upgrader/playbook
...
...
@@ -67,12 +89,38 @@
register
:
current_upgrade_signature
-
name
:
Setting playbook report message
set_fact
:
playbook_report_message="Running upgrade" playbook_report_progress="10"
-
name
:
Render log template
template
:
src
:
playbook-report.j2
dest
:
/tmp/playbook-report-tmp.log
when
:
playbook_report | bool
-
name
:
Append to 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'))
-
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
when
:
(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'))
args
:
chdir
:
/opt/upgrader/playbook-tmp/
-
name
:
Setting playbook report message
set_fact
:
playbook_report_message="Running extra playbook" playbook_report_progress="60"
-
name
:
Render log template
template
:
src
:
playbook-report.j2
dest
:
/tmp/playbook-report-tmp.log
when
:
playbook_report | bool
-
name
:
Append to log
shell
:
'
cat
/tmp/playbook-report-tmp.log
>>
{{
monitor_path.stdout
}}/playbook-report/report.log'
when
:
(playbook_report | bool) and (extra_playbook | length > 0)
-
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
when
:
extra_playbook | length >
0
...
...
@@ -94,6 +142,19 @@
-
include
:
remove-legacy.yml
-
name
:
Setting playbook report message
set_fact
:
playbook_report_message="Successfully ran playbook" playbook_report_progress="100"
-
name
:
Render log template
template
:
src
:
playbook-report.j2
dest
:
/tmp/playbook-report-tmp.log
when
:
playbook_report | bool
-
name
:
Append to log
shell
:
'
cat
/tmp/playbook-report-tmp.log
>>
{{
monitor_path.stdout
}}/playbook-report/report.log'
when
:
playbook_report | bool
-
name
:
Remove cron after successful playbook run
cron
:
name="Repeat until success" state=absent
when
:
repeat_until_success | bool
...
...
playbook/roles/upgrader/templates/playbook-report.j2
0 → 100644
View file @
bb1070de
{"time": "{{ ansible_date_time['date'] }} {{ ansible_date_time['time'] }}", "log_level": "INFO", "message": "{{ playbook_report_message }}", "progress": "{{ playbook_report_progress }}"}
playbook/sha256sum
View file @
bb1070de
6bd60d4d534e224e6eb8ed095ef0937dd490859b4db0470a9bc9cc947d3c1ce6
-
a5607f15135faed20570bf135a3fb9f2db8167f1463a58d302bbffcafb94a7e7
-
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment