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
Łukasz Nowak
slapos.package
Commits
00bbd6cd
Commit
00bbd6cd
authored
Dec 11, 2015
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook: upgrader for imt vm-bootstrap
parent
fcae174d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
70 additions
and
6 deletions
+70
-6
playbook/roles/vm-bootstrap/tasks/hostname.yml
playbook/roles/vm-bootstrap/tasks/hostname.yml
+2
-6
playbook/roles/vm-bootstrap/tasks/main.yml
playbook/roles/vm-bootstrap/tasks/main.yml
+31
-0
playbook/roles/vm-bootstrap/tasks/upgrader.yml
playbook/roles/vm-bootstrap/tasks/upgrader.yml
+37
-0
No files found.
playbook/roles/vm-bootstrap/tasks/hostname.yml
View file @
00bbd6cd
...
...
@@ -8,10 +8,6 @@
get_url
:
url=http://10.0.2.100/ipv4 dest=/etc/opt/ipv4 mode=666
ignore_errors
:
True
-
name
:
Download cluster.hash
get_url
:
url=http://10.0.2.100/cluster.hash dest=/tmp/cluster.hash mode=666
ignore_errors
:
True
-
name
:
stat /etc/opt/hostname
stat
:
path=/etc/opt/hostname
register
:
hostname_file
...
...
@@ -20,8 +16,8 @@
stat
:
path=/etc/opt/ipv4
register
:
ipv4_file
-
name
:
stat
/tmp/
cluster.hash
stat
:
path=/
tmp
/cluster.hash
-
name
:
stat cluster.hash
stat
:
path=/
etc/opt
/cluster.hash
register
:
cluster_hash
-
name
:
replace /etc/hostname
...
...
playbook/roles/vm-bootstrap/tasks/main.yml
View file @
00bbd6cd
...
...
@@ -23,8 +23,39 @@
when
:
netconfig_file.stat.exists == True
ignore_errors
:
True
-
name
:
Download cluster.hash
get_url
:
url=http://10.0.2.100/cluster.hash dest=/etc/opt/cluster.hash mode=644
ignore_errors
:
True
-
name
:
stat cluster.hash
stat
:
path=/etc/opt/cluster.hash
register
:
cluster_hash
-
name
:
get upgrade file if exists
shell
:
wget --no-check-certificate "{{ lookup('file', '/etc/opt/cluster.hash') }}/data" -O /etc/opt/upgrade.after
when
:
cluster_hash.stat.exists == True
ignore_errors
:
True
-
name
:
stat file upgrade.after
stat
:
path=/etc/opt/upgrade.after
register
:
upgrade_set
-
name
:
check if the plabook should be upgraded
shell
:
cat /etc/opt/upgrade.after
register
:
upgrade_time
when
:
upgrade_set.stat.exists == True
-
include
:
network.yml
-
include
:
hostname.yml
-
include
:
user.yml
-
include
:
sudo.yml
-
include
:
ssh.yml
-
stat
:
path=/opt/upgrader/last-upgrade
register
:
last_upgrade
-
shell
:
echo 1 > /opt/upgrader/last-upgrade
when
:
last_upgrade.stat.exists == False
-
include
:
upgrader.yml upgrade_after={{ upgrade_time.stdout }}
when
:
upgrade_set.stat.exists == True and (upgrade_time.stdout|int > lookup('file', '/opt/upgrader/last-upgrade')|int)
playbook/roles/vm-bootstrap/tasks/upgrader.yml
0 → 100644
View file @
00bbd6cd
---
-
file
:
path=/opt/upgrader state=directory mode=0755
-
stat
:
path=/opt/upgrader/current-upgrade-signature
register
:
current_upgrade_signature
-
file
:
path=/opt/upgrader/ state=directory mode=0755
-
shell
:
rm -rf /opt/upgrader/playbook/
-
shell
:
rm -rf /opt/upgrader/archive.tar.gz
-
shell
:
mkdir -p /opt/upgrader/playbook
-
name
:
Download the latest playbook
shell
:
slapcache-download --destination=/opt/upgrader/archive.tar.gz
-
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"
when
:
current_upgrade_signature.stat.exists == False
-
name
:
Copy slapos.playbook
shell
:
tar -xzvf /opt/upgrader/archive.tar.gz
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'))
args
:
chdir
:
/opt/slapos.playbook
-
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
when
:
(upgrade_after|int > lookup('file', '/opt/upgrader/last-upgrade')|int )
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