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
fa8b44d3
Commit
fa8b44d3
authored
Jun 17, 2016
by
Alain Takoudjou
Committed by
Rafael Monnerat
Jun 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playbook: generate vm-bootstrap full install script
parent
958254c7
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
93 additions
and
1 deletion
+93
-1
playbook/install-script.yml
playbook/install-script.yml
+1
-0
playbook/roles/install-script/files/vm_bootstrap_check
playbook/roles/install-script/files/vm_bootstrap_check
+18
-0
playbook/roles/install-script/files/vm_bootstrap_network
playbook/roles/install-script/files/vm_bootstrap_network
+11
-0
playbook/roles/install-script/tasks/main.yml
playbook/roles/install-script/tasks/main.yml
+9
-1
playbook/roles/install-script/templates/vm_bootstrap.j2
playbook/roles/install-script/templates/vm_bootstrap.j2
+19
-0
playbook/roles/install-script/templates/vm_bootstrap_unstable.j2
...k/roles/install-script/templates/vm_bootstrap_unstable.j2
+35
-0
No files found.
playbook/install-script.yml
View file @
fa8b44d3
...
...
@@ -66,6 +66,7 @@
-
{
role
:
"
install-script"
,
channel
:
"
stable"
,
playbook_yml
:
"
imt-server-update.yml"
,
script_path
:
"
install/imt/slapos-update"
}
-
{
role
:
"
install-script"
,
channel
:
"
stable"
,
playbook_yml
:
"
imt-server.yml"
,
script_path
:
"
install/imt/slapos"
}
-
{
role
:
"
install-script"
,
channel
:
"
stable"
,
playbook_yml
:
"
imt-vm-bootstrap.yml"
,
script_path
:
"
install/imt/vm-bootstrap"
}
-
{
role
:
"
install-script"
,
channel
:
"
stable"
,
playbook_yml
:
"
imt-vm-bootstrap.yml"
,
script_path
:
"
install/imt/generic-vm-bootstrap"
}
-
{
role
:
"
install-script"
,
channel
:
"
stable"
,
playbook_yml
:
"
imt-vm-cloudera-manager.yml"
,
script_path
:
"
install/imt/vm-cloudera-manager"
}
-
{
role
:
"
install-script"
,
channel
:
"
stable"
,
playbook_yml
:
"
imt-re6stnet.yml"
,
script_path
:
"
install/imt/re6st"
}
...
...
playbook/roles/install-script/files/vm_bootstrap_check
0 → 100644
View file @
fa8b44d3
# Check if playbook has been correctly extracted
ANSIBLE_CRON_FILE="/etc/cron.d/ansible-vm-bootstrap"
COUNT=$(ls /opt/slapos.playbook | wc -l)
if [[ ! $COUNT -gt 1 ]]
then
rm -f $ANSIBLE_CRON_FILE
rm -f /opt/slapos.playbook/playbook.tar.gz
exit 1
fi
# check if Ansible cron task was added
if [[ ! -s "$ANSIBLE_CRON_FILE" ]]
then
exit 1
fi
exit 0
playbook/roles/install-script/files/vm_bootstrap_network
0 → 100644
View file @
fa8b44d3
# Configure network interface
rm -rf /tmp/dropcmd
wget -O /etc/opt/netconfigure http://10.0.2.100/netconfig.sh
wget -O /tmp/dropcmd -q http://10.0.2.100/delDefaultIface
if [[ -s "/tmp/dropcmd" ]]
then
echo "nameserver 8.8.8.8" > /etc/resolv.conf
/sbin/ip route del default
fi
bash /etc/opt/netconfigure
playbook/roles/install-script/tasks/main.yml
View file @
fa8b44d3
...
...
@@ -3,10 +3,18 @@
template
:
src=install.j2 dest={{ base_path }}/{{ script_path }} mode=0666
when
:
channel == "stable"
-
name
:
generate scripts
template
:
src=vm_bootstrap.j2 dest={{ base_path }}/{{ script_path }} mode=0666
when
:
channel == "stable" and "generic-vm-bootstrap" in script_path
-
name
:
generate scripts
template
:
src=install_unstable.j2 dest={{ base_path }}/{{ script_path }} mode=0666
when
:
channel == "unstable"
-
name
:
generate scripts
template
:
src=vm_bootstrap_unstable.j2 dest={{ base_path }}/{{ script_path }} mode=0666
when
:
channel == "unstable" and "vm-bootstrap" in script_path
-
name
:
generate scripts
template
:
src=install_slapos.j2 dest={{ base_path }}/{{ script_path }} mode=0666
when
:
channel == "slapos"
...
...
@@ -16,4 +24,4 @@
when
:
channel == "slapos_testing"
-
name
:
Set ansible playbook on scripts
lineinfile
:
dest={{ base_path }}/{{ script_path }} line="ansible-playbook {{ playbook_yml }} -i hosts --connection=local" state=present
lineinfile
:
dest={{ base_path }}/{{ script_path }} line="ansible-playbook {{ playbook_yml }} -i hosts --connection=local" state=present
insertafter="echo\s+\"Starting Ansible playbook:.*"
playbook/roles/install-script/templates/vm_bootstrap.j2
0 → 100644
View file @
fa8b44d3
#!/bin/bash
{{
lookup
(
'file'
, base_path+
'/roles/install-script/files/vm_bootstrap_network'
)
}}
set
-e
### Include Bootstrap VM script
### Contain function-common
## https://lab.nexedi.com/nexedi/slapos.package/blob/master/playbook/roles/install-script/files/function-common
{{
lookup
(
'file'
, base_path+
'/install/base-setup'
)
}}
download_playbook
clear
echo
"Starting Ansible playbook:"
{{
lookup
(
'file'
, base_path+
'/roles/install-script/files/vm_bootstrap_check'
)
}}
playbook/roles/install-script/templates/vm_bootstrap_unstable.j2
0 → 100644
View file @
fa8b44d3
#!/bin/bash
{{
lookup
(
'file'
, base_path+
'/roles/install-script/files/vm_bootstrap_network'
)
}}
set
-e
#
# Paste content of function-common
# https://lab.nexedi.com/nexedi/slapos.package/blob/master/playbook/roles/install-script/files/function-common
#
{{
lookup
(
'file'
, base_path+
'/install/base-setup'
)
}}
# Include Additional Functions
if
[
!
-f
/etc/opt/slapcache.cfg
]
;
then
slapcache-conf
fi
sed
-i
"s/key = slapos-global-key/key = slapos-global-unstable-key/g"
/etc/opt/slapcache.cfg
DFILE
=
"/tmp/tmpplaybook_unstable
$(
basename
$0
)
.
$$
/"
TFILE
=
"archive.tar.gz"
mkdir
-p
$DFILE
cd
$DFILE
slapcache-download
--destination
=
$TFILE
tar
-xzvf
$TFILE
rm
$TFILE
clear
echo
"Starting Ansible playbook:"
{{
lookup
(
'file'
, base_path+
'/roles/install-script/files/vm_bootstrap_check'
)
}}
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