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
Jérome Perrin
slapos.package
Commits
910d2148
Commit
910d2148
authored
Sep 14, 2016
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm-boostrap playbook: skip some tasks when playbook is well configured
parent
8e7d5a06
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
7 deletions
+25
-7
playbook/imt-vm-bootstrap.yml
playbook/imt-vm-bootstrap.yml
+14
-5
playbook/roles/vm-bootstrap/tasks/hostname.yml
playbook/roles/vm-bootstrap/tasks/hostname.yml
+1
-0
playbook/roles/vm-bootstrap/tasks/main.yml
playbook/roles/vm-bootstrap/tasks/main.yml
+3
-0
playbook/roles/vm-bootstrap/tasks/ssh.yml
playbook/roles/vm-bootstrap/tasks/ssh.yml
+2
-1
playbook/roles/vm-bootstrap/tasks/upgrader.yml
playbook/roles/vm-bootstrap/tasks/upgrader.yml
+3
-0
playbook/roles/vm-bootstrap/tasks/user.yml
playbook/roles/vm-bootstrap/tasks/user.yml
+2
-1
No files found.
playbook/imt-vm-bootstrap.yml
View file @
910d2148
...
@@ -2,7 +2,16 @@
...
@@ -2,7 +2,16 @@
hosts
:
127.0.0.1
hosts
:
127.0.0.1
connection
:
local
connection
:
local
pre_tasks
:
-
name
:
Get mounted disk list
script
:
roles/vm-bootstrap/files/mounted_disk
register
:
vd_list
-
name
:
resgister completed variable
stat
:
path=/etc/opt/vm-bootstrap-completed
register
:
ansible_completed
vars
:
vars
:
is_playbook_ok
:
"
{{
ansible_completed.stat.exists
}}"
logrotate_args
:
logrotate_args
:
-
name
:
vm-bootstrap
-
name
:
vm-bootstrap
path
:
/var/log/vm-bootstrap.log
path
:
/var/log/vm-bootstrap.log
...
@@ -14,11 +23,6 @@
...
@@ -14,11 +23,6 @@
-
create
-
create
-
dateext
-
dateext
pre_tasks
:
-
name
:
Get mounted disk list
script
:
roles/vm-bootstrap/files/mounted_disk
register
:
vd_list
roles
:
roles
:
-
{
role
:
vm-bootstrap
,
startup_playbook_id
:
imt-vm-bootstrap.yml
}
-
{
role
:
vm-bootstrap
,
startup_playbook_id
:
imt-vm-bootstrap.yml
}
-
ntp
-
ntp
...
@@ -44,4 +48,9 @@
...
@@ -44,4 +48,9 @@
-
{
role
:
vm-disks
,
vd_disk
:
u
,
data_n
:
12
,
when
:
vd_list.stdout.find("vdu") != -1
}
-
{
role
:
vm-disks
,
vd_disk
:
u
,
data_n
:
12
,
when
:
vd_list.stdout.find("vdu") != -1
}
-
role
:
logrotate
-
role
:
logrotate
logrotate_scripts
:
"
{{logrotate_args}}"
logrotate_scripts
:
"
{{logrotate_args}}"
when
:
ansible_completed.stat.exists == False
tasks
:
-
name
:
Set tasks complete
file
:
path=/etc/opt/vm-bootstrap-completed state=touch
changed_when
:
false
playbook/roles/vm-bootstrap/tasks/hostname.yml
View file @
910d2148
...
@@ -59,6 +59,7 @@
...
@@ -59,6 +59,7 @@
-
name
:
Delete nameserver 8.8.8.8
-
name
:
Delete nameserver 8.8.8.8
lineinfile
:
dest=/etc/resolv.conf line="nameserver 8.8.8.8" state=absent
lineinfile
:
dest=/etc/resolv.conf line="nameserver 8.8.8.8" state=absent
when
:
is_playbook_ok == "False"
-
name
:
Turn off dhclient if it's running
-
name
:
Turn off dhclient if it's running
shell
:
pkill dhclient
shell
:
pkill dhclient
...
...
playbook/roles/vm-bootstrap/tasks/main.yml
View file @
910d2148
-
include
:
uploadlog.yml
-
include
:
uploadlog.yml
when
:
is_playbook_ok == "False"
-
include
:
rerun.yml
-
include
:
rerun.yml
when
:
is_playbook_ok == "False"
-
name
:
Create /etc/opt dir
-
name
:
Create /etc/opt dir
file
:
dest=/etc/opt mode=775 state=directory
file
:
dest=/etc/opt mode=775 state=directory
...
@@ -49,6 +51,7 @@
...
@@ -49,6 +51,7 @@
-
include
:
hostname.yml
-
include
:
hostname.yml
-
include
:
user.yml
-
include
:
user.yml
-
include
:
sudo.yml
-
include
:
sudo.yml
when
:
is_playbook_ok == "False"
-
include
:
ssh.yml
-
include
:
ssh.yml
-
file
:
path=/opt/upgrader state=directory
-
file
:
path=/opt/upgrader state=directory
...
...
playbook/roles/vm-bootstrap/tasks/ssh.yml
View file @
910d2148
...
@@ -51,11 +51,12 @@
...
@@ -51,11 +51,12 @@
always_run
:
True
always_run
:
True
ignore_errors
:
True
ignore_errors
:
True
changed_when
:
False
changed_when
:
False
when
:
is_playbook_ok == "False"
-
name
:
update /etc/ssh/sshd_config
-
name
:
update /etc/ssh/sshd_config
lineinfile
:
dest=/etc/ssh/sshd_config regexp="^PermitRootLogin (.*)" line="PermitRootLogin no" state=present
lineinfile
:
dest=/etc/ssh/sshd_config regexp="^PermitRootLogin (.*)" line="PermitRootLogin no" state=present
notify
:
notify
:
-
restart ssh
-
restart ssh
-
restart sshd
-
restart sshd
when
:
permitrootlogin.rc !=
0
when
:
is_playbook_ok == "False" and
permitrootlogin.rc !=
0
playbook/roles/vm-bootstrap/tasks/upgrader.yml
View file @
910d2148
---
---
-
name
:
Remove playbook completed file
file
:
path=/etc/opt/vm-bootstrap-completed state=absent
-
file
:
path=/opt/upgrader state=directory mode=0755
-
file
:
path=/opt/upgrader state=directory mode=0755
-
stat
:
path=/opt/upgrader/current-upgrade-signature
-
stat
:
path=/opt/upgrader/current-upgrade-signature
...
...
playbook/roles/vm-bootstrap/tasks/user.yml
View file @
910d2148
...
@@ -8,3 +8,4 @@
...
@@ -8,3 +8,4 @@
with_items
:
with_items
:
-
slapos
-
slapos
-
nexedi
-
nexedi
when
:
is_playbook_ok == "False"
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