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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
slapos.package
Commits
fd0c4951
Commit
fd0c4951
authored
Sep 14, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm-bootstrap plabook: sleep before start rerun script, periodicity can be defined
parent
85c8f0e0
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
2 deletions
+10
-2
playbook/roles/vm-bootstrap/tasks/rerun.yml
playbook/roles/vm-bootstrap/tasks/rerun.yml
+6
-1
playbook/roles/vm-bootstrap/tasks/uploadlog.yml
playbook/roles/vm-bootstrap/tasks/uploadlog.yml
+1
-1
playbook/roles/vm-bootstrap/templates/start-script.j2
playbook/roles/vm-bootstrap/templates/start-script.j2
+3
-0
No files found.
playbook/roles/vm-bootstrap/tasks/rerun.yml
View file @
fd0c4951
...
...
@@ -2,9 +2,14 @@
-
name
:
Add startup script
template
:
src=start-script.j2 dest=/usr/local/bin/vm-bootstrap-update mode=755
-
name
:
get periodicity time
shell
:
cat /etc/opt/periodicity || echo
10
register
:
periodicity
ignore_errors
:
True
-
name
:
Add a periodical update on the VM
cron
:
name="Update vm bootstrap"
minute="*/
12
"
minute="*/
{{ periodicity.stdout }}
"
job="bash -lc /usr/local/bin/vm-bootstrap-update >> /var/log/vm-bootstrap.log"
cron_file=ansible-vm-bootstrap user="root"
...
...
playbook/roles/vm-bootstrap/tasks/uploadlog.yml
View file @
fd0c4951
...
...
@@ -4,6 +4,6 @@
-
name
:
Add a periodical upload of logs and result
cron
:
name="Upload ansible files to http server"
minute="*/
7
"
minute="*/
5
"
job="/usr/local/bin/ansible-upload-vm-logs http://10.0.2.100/ /var/log/vm-bootstrap.log > /var/log/ansible-upload.log"
cron_file=ansible-upload-log user="root"
playbook/roles/vm-bootstrap/templates/start-script.j2
View file @
fd0c4951
...
...
@@ -2,5 +2,8 @@
# Reruns the ansible playbook, does nothing else
cd
/opt/slapos.playbook
WAIT_TIME
=
$((
1
+
RANDOM
%
300
))
echo
"Sleeping for
$WAIT_TIME
seconds..."
sleep
$WAIT_TIME
ansible-playbook
{{
startup_playbook_id
}}
-i
hosts
--connection
=
local
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