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
Ayush Tiwari
slapos.package
Commits
db0d2246
Commit
db0d2246
authored
Jun 15, 2015
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook: Include proof of concept of upgrader role
parent
3d1c5f50
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
1 deletion
+92
-1
playbook/roles/upgrader/files/download-upgrader-playbook
playbook/roles/upgrader/files/download-upgrader-playbook
+16
-0
playbook/roles/upgrader/tasks/main.yml
playbook/roles/upgrader/tasks/main.yml
+46
-0
playbook/upgrader-run.yml
playbook/upgrader-run.yml
+7
-0
playbook/vifib-upgrade.yml
playbook/vifib-upgrade.yml
+19
-0
playbook/vifib.yml
playbook/vifib.yml
+4
-1
No files found.
playbook/roles/upgrader/files/download-upgrader-playbook
0 → 100644
View file @
db0d2246
#!/bin/bash
if
[
!
-f
/etc/opt/slapcache.cfg
]
;
then
slapcache-conf
fi
DFILE
=
"/opt/upgrader/"
TFILE
=
"archive.tar.gz"
mkdir
-p
$DFILE
cd
$DFILE
slapcache-download
--destination
=
$TFILE
tar
-xzvf
$TFILE
md5sum
$TFILE
>
"/opt/upgrader/next-upgrader-md5sum"
playbook/roles/upgrader/tasks/main.yml
0 → 100644
View file @
db0d2246
---
-
file
:
path=/opt/upgrader/ state=directory mode=0755
-
shell
:
rm -rf /opt/upgrader/playbook/
-
file
:
path=/opt/upgrader/playbook/ state=directory mode=0755
-
name
:
Periodically download the latest playbook
shell
:
slapcache-download --destination=/opt/upgrader/archive.tar.gz
-
name
:
Uncompress
unarchive
:
src=/opt/upgrader/archive.tar.gz dest=/opt/upgrader/playbook/
-
name
:
Save new archive MD5
stat
:
path=/opt/upgrader/archive.tar.gz
register
:
archive
-
name
:
Update playbook md5
shell
:
echo {{ archive.stat.md5 }} > /opt/upgrader/next-upgrade-signature
-
name
:
Stat Current Upgrade Signature
file
:
path=/opt/upgrader/current-upgrade-signature state=touch mode="0666"
-
name
:
Get /opt/upgrader/next-upgrade-signature content
shell
:
cat /opt/upgrader/next-upgrade-signature
register
:
next_upgrade_signature
-
name
:
Get /opt/upgrader/current-upgrade-signature content
shell
:
cat /opt/upgrader/current-upgrade-signature
register
:
current_upgrade_signature
-
name
:
Do upgrade
shell
:
ansible-playbook {{ upgrader_playbook }} -i hosts >> /opt/upgrader/latest_upgrade.log
when
:
lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature')
args
:
chdir
:
/opt/upgrader/playbook/
-
name
:
Upgrade Current Upgrade Signature
shell
:
cat /opt/upgrader/next-upgrade-signature > /opt/upgrader/current-upgrade-signature
when
:
lookup('file', '/opt/upgrader/next-upgrade-signature') != lookup('file', '/opt/upgrader/current-upgrade-signature')
-
name
:
Set Cron
cron
:
name="Launch Upgrader" minute="0" hour="*/3" job='ansible-playbook upgrader-run.yml --with-vars "upgrader-playbook={{ upgrader_playbook }}" -i hosts >> /opt/upgrader/latest_upgrade.log'
playbook/upgrader-run.yml
0 → 100644
View file @
db0d2246
-
name
:
a play that runs entirely on the ansible host
hosts
:
127.0.0.1
connection
:
local
roles
:
-
upgrader
playbook/vifib-upgrade.yml
0 → 100644
View file @
db0d2246
-
name
:
a play that runs entirely on the ansible host
hosts
:
127.0.0.1
connection
:
local
vars
:
-
upgrader-playbook
:
vifib-upgrader.yml
-
computer_name
:
noname
-
slapostoken
:
notoken
vars_files
:
-
settings/vifib.yml
roles
:
-
{
role
:
re6stnet-legacy
,
package_state
:
latest
}
-
{
role
:
slapos
,
package_state
:
latest
}
-
{
role
:
package
,
package_name
:
ntp
,
package_state
:
latest
}
-
{
role
:
package
,
package_name
:
ntp
,
package_state
:
latest
}
-
vifib-server
-
upgrader
playbook/vifib.yml
View file @
db0d2246
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
hosts
:
127.0.0.1
hosts
:
127.0.0.1
connection
:
local
connection
:
local
vars
:
-
upgrader-playbook
:
vifib-upgrader.yml
vars_files
:
vars_files
:
-
settings/vifib.yml
-
settings/vifib.yml
...
@@ -21,4 +24,4 @@
...
@@ -21,4 +24,4 @@
-
{
role
:
slapos
,
package_state
:
present
}
-
{
role
:
slapos
,
package_state
:
present
}
-
{
role
:
package
,
package_name
:
ntp
,
package_state
:
present
}
-
{
role
:
package
,
package_name
:
ntp
,
package_state
:
present
}
-
vifib-server
-
vifib-server
-
upgrader
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