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
Carlos Ramos Carreño
slapos.package
Commits
6bc7c003
Commit
6bc7c003
authored
Sep 07, 2023
by
Joanne Hugé
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook/vifib-server, upgrader: add alternative anacron playbook scheduler
parent
2e4de82b
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
32 additions
and
20 deletions
+32
-20
playbook/ors.yml
playbook/ors.yml
+2
-0
playbook/roles/upgrader/defaults/main.yml
playbook/roles/upgrader/defaults/main.yml
+2
-0
playbook/roles/upgrader/tasks/main.yml
playbook/roles/upgrader/tasks/main.yml
+21
-4
playbook/roles/vifib-server/defaults/main.yml
playbook/roles/vifib-server/defaults/main.yml
+1
-0
playbook/roles/vifib-server/tasks/main.yml
playbook/roles/vifib-server/tasks/main.yml
+1
-0
playbook/roles/vm-bootstrap/tasks/upgrader.yml
playbook/roles/vm-bootstrap/tasks/upgrader.yml
+2
-2
playbook/settings/upgrader.yml
playbook/settings/upgrader.yml
+0
-2
playbook/sha256sum
playbook/sha256sum
+1
-1
playbook/upgrade_after
playbook/upgrade_after
+1
-0
playbook/upgrader-run.yml
playbook/upgrader-run.yml
+0
-4
playbook/util/update-upgrader-timestamp
playbook/util/update-upgrader-timestamp
+1
-1
playbook/vifib-base.yml
playbook/vifib-base.yml
+0
-1
playbook/vifib-upgrader-install.yml
playbook/vifib-upgrader-install.yml
+0
-3
playbook/vifib-without-re6stnet.yml
playbook/vifib-without-re6stnet.yml
+0
-1
playbook/vifib.yml
playbook/vifib.yml
+0
-1
No files found.
playbook/ors.yml
View file @
6bc7c003
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
connection
:
local
connection
:
local
vars_files
:
vars_files
:
-
settings/vifib.yml
-
settings/slapos-master.yml
-
settings/ors.yml
-
settings/ors.yml
roles
:
roles
:
...
...
playbook/roles/upgrader/defaults/main.yml
View file @
6bc7c003
period_minute
:
'
0'
period_minute
:
'
0'
period_hour
:
'
*/3'
period_hour
:
'
*/3'
extra_playbook
:
'
'
repeat_until_success
:
False
playbook/roles/upgrader/tasks/main.yml
View file @
6bc7c003
---
---
-
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 \"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
-
file
:
path=/opt/upgrader state=directory mode=0755
-
file
:
path=/opt/upgrader state=directory mode=0755
-
stat
:
path=/opt/upgrader/playbook
-
stat
:
path=/opt/upgrader/playbook
...
@@ -64,21 +68,34 @@
...
@@ -64,21 +68,34 @@
current_upgrade_signature
current_upgrade_signature
-
name
:
Do upgrade
-
name
:
Do upgrade
shell
:
ansible-playbook {{ upgrader_playbook }} -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
when
:
(
upgrade_after
> lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature'))
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
:
args
:
chdir
:
/opt/upgrader/playbook-tmp/
chdir
:
/opt/upgrader/playbook-tmp/
-
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
-
name
:
Set Cron
-
name
:
Set Cron
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 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\""
when
:
repeat_until_success | bool == False
-
cron
:
name="Launch Upgrader" state=absent
-
cron
:
name="Launch Upgrader" state=absent
-
name
:
Upgrade Current Upgrade Signature
-
name
:
Upgrade Current Upgrade Signature
shell
:
cat /opt/upgrader/next-upgrade-signature > /opt/upgrader/current-upgrade-signature
shell
:
cat /opt/upgrader/next-upgrade-signature > /opt/upgrader/current-upgrade-signature
when
:
(
upgrade_after
> lookup('file', '/opt/upgrader/last-upgrade')|int ) and (lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature'))
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'))
-
shell
:
echo {{ ansible_date_time.epoch }} > /opt/upgrader/last-upgrade
-
shell
:
echo {{ ansible_date_time.epoch }} > /opt/upgrader/last-upgrade
when
:
(
upgrade_after
> lookup('file', '/opt/upgrader/last-upgrade')|int )
when
:
(
lookup('file', '/opt/upgrader/playbook-tmp/upgrade_after')|int
> lookup('file', '/opt/upgrader/last-upgrade')|int )
-
include
:
remove-legacy.yml
-
include
:
remove-legacy.yml
-
name
:
Remove cron after successful playbook run
cron
:
name="Repeat until success" state=absent
when
:
repeat_until_success | bool
-
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 \"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_daily_upgrade.log >> /opt/upgrader/latest_daily_upgrade.log\"" state=present
when
:
repeat_until_success | bool
playbook/roles/vifib-server/defaults/main.yml
0 → 100644
View file @
6bc7c003
repeat_until_success
:
False
playbook/roles/vifib-server/tasks/main.yml
View file @
6bc7c003
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
-
name
:
Set Cron
-
name
:
Set Cron
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"'
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"'
when
:
repeat_until_success | bool == False
-
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
...
...
playbook/roles/vm-bootstrap/tasks/upgrader.yml
View file @
6bc7c003
...
@@ -30,8 +30,8 @@
...
@@ -30,8 +30,8 @@
-
name
:
Copy slapos.playbook
-
name
:
Copy slapos.playbook
unarchive
:
src=/opt/upgrader/archive.tar.gz dest=/opt/slapos.playbook
unarchive
:
src=/opt/upgrader/archive.tar.gz dest=/opt/slapos.playbook
when
:
(
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
:
(
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
:
Upgrade Current Upgrade Signature
-
name
:
Upgrade Current Upgrade Signature
shell
:
echo /opt/upgrader/next-upgrade-signature > /opt/upgrader/current-upgrade-signature && echo {{ ansible_date_time.epoch }} > /opt/upgrader/last-upgrade
shell
:
echo /opt/upgrader/next-upgrade-signature > /opt/upgrader/current-upgrade-signature && echo {{ ansible_date_time.epoch }} > /opt/upgrader/last-upgrade
when
:
(
upgrade_after
|int > lookup('file', '/opt/upgrader/last-upgrade')|int )
when
:
(
lookup('file', '/opt/upgrader/playbook-tmp/upgrade_after')
|int > lookup('file', '/opt/upgrader/last-upgrade')|int )
playbook/settings/upgrader.yml
deleted
100644 → 0
View file @
2e4de82b
---
upgrade_after
:
1688117268
playbook/sha256sum
View file @
6bc7c003
32d040685a3d3cbc9b2a368a9f38a3d1bc47e4289ea14f7395bbf64121e3d08e
-
572976325d64d618608d19c42dc6e2879086da332887672fc6a7f42c640e2472
-
playbook/upgrade_after
0 → 100644
View file @
6bc7c003
1688117268
playbook/upgrader-run.yml
View file @
6bc7c003
...
@@ -2,10 +2,6 @@
...
@@ -2,10 +2,6 @@
hosts
:
127.0.0.1
hosts
:
127.0.0.1
connection
:
local
connection
:
local
vars_files
:
-
settings/upgrader.yml
roles
:
roles
:
-
upgrader
-
upgrader
playbook/util/update-upgrader-timestamp
View file @
6bc7c003
cd $(dirname $(realpath $0))/..
cd $(dirname $(realpath $0))/..
sed -i "s/upgrade_after:.*/upgrade_after: `date +%s`/g" settings/upgrader.yml
date +%s > upgrade_after
playbook/vifib-base.yml
View file @
6bc7c003
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
vars_files
:
vars_files
:
-
settings/vifib.yml
-
settings/vifib.yml
-
settings/upgrader.yml
-
settings/slapos-master.yml
-
settings/slapos-master.yml
roles
:
roles
:
...
...
playbook/vifib-upgrader-install.yml
View file @
6bc7c003
...
@@ -5,9 +5,6 @@
...
@@ -5,9 +5,6 @@
vars
:
vars
:
-
upgrader_playbook
:
vifib-upgrade.yml
-
upgrader_playbook
:
vifib-upgrade.yml
vars_files
:
-
settings/upgrader.yml
roles
:
roles
:
-
upgrader
-
upgrader
playbook/vifib-without-re6stnet.yml
View file @
6bc7c003
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
vars_files
:
vars_files
:
-
settings/vifib.yml
-
settings/vifib.yml
-
settings/upgrader.yml
-
settings/slapos-master.yml
-
settings/slapos-master.yml
vars_prompt
:
vars_prompt
:
...
...
playbook/vifib.yml
View file @
6bc7c003
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
vars_files
:
vars_files
:
-
settings/vifib.yml
-
settings/vifib.yml
-
settings/upgrader.yml
-
settings/slapos-master.yml
-
settings/slapos-master.yml
vars_prompt
:
vars_prompt
:
...
...
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