-
Notifications
You must be signed in to change notification settings - Fork 34
/
all-in-one.sh
executable file
·106 lines (94 loc) · 2.93 KB
/
all-in-one.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
# Copyright 2015 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
# Deploy Puppet OpenStack modules, deploy OpenStack and test the setup.
# Software requirements:
# * Ubuntu 22.04 LTS or CentOS Stream 9 fresh install
# * 'git' installed
#
# Hardware requirements:
# * At least 4GB of memory, but 8GB is recommended
# * At least 10GB of storage
#
# Usage:
# $ git clone https://opendev.org/openstack/puppet-openstack-integration
# $ cd puppet-openstack-integration
# $ ./all-in-one.sh
#
set -e
if [ -n "$DEBUG" ]; then
set -x
fi
export SCENARIO=scenario-aio
export SCRIPT_DIR=$(cd `dirname $0` && pwd -P)
source $SCRIPT_DIR/functions
print_header 'Start (all-in-one.sh)'
if is_fedora; then
print_header 'Setup (RedHat based)'
sudo -E dnf -y remove facter puppet rdo-release
sudo -E dnf -y install libxml2-devel libxslt-devel ruby-devel rubygems wget qemu-img
sudo -E dnf -y groupinstall "Development Tools"
DASHBOARD="dashboard"
elif uses_debs; then
print_header 'Setup (Debian based)'
sudo apt-get update
sudo apt-get install -y libxml2-dev libxslt-dev zlib1g-dev ruby wget lsb-release curl apt-transport-https qemu-img
# Only purge puppet in Ubuntu, in Debian we use
# what the distribution provides.
if [ $(lsb_release --id -s) = "Ubuntu" ] ; then
sudo apt-get remove -y --purge facter puppet puppet-common
fi
DASHBOARD="horizon"
fi
if [ $(lsb_release --id -s) = "Debian" ] ; then
sudo apt-get install -y adduser
if ! getent passwd puppet ; then
adduser --disabled-password --gecos puppet,,, puppet
fi
fi
print_header 'Install Bundler'
mkdir -p .bundled_gems
export GEM_HOME=`pwd`/.bundled_gems
ruby <<EOF
cmd = 'gem install --no-user-install bundler --no-document --verbose'
system(cmd)
EOF
set -e
./run_tests.sh
RESULT=$?
set +e
if [ $RESULT -ne 0 ]; then
echo "Deployment failed to finish."
exit 1
fi
print_header 'Setup openrc'
cat > ~/openrc <<EOF
export OS_PROJECT_DOMAIN_ID=default
export OS_USER_DOMAIN_ID=default
export OS_PROJECT_NAME=openstack
export OS_TENANT_NAME=openstack
export OS_USERNAME=admin
export OS_PASSWORD=a_big_secret
export OS_AUTH_URL=http://127.0.0.1:5000/v3
export OS_IDENTITY_API_VERSION=3
EOF
cat <<-EOF
OpenStack Dashboard available: http://127.0.0.1/${DASHBOARD}
To access through Horizon, use the following user/password:
admin / a_big_secret
To use OpenStack through the CLI, run:
source ~/openrc
EOF
print_header 'Done (all-in-one.sh)'