Skip to content

Handle compress vm image files and added documentation #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 03_configure_undercloud.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ if ! openstack image show cirros; then
openstack image create cirros --container-format bare --disk-format qcow2 --public --file "$CIRROS_IMAGE_FILENAME"
fi

./get-rhcos-image.sh
./get-rhcos-image.sh $RHCOS_IMAGE_FILENAME
RHOS_IMAGE_HASH=$(sha512sum $RHCOS_IMAGE_FILENAME | awk '{print $1}')
if ! openstack image show rhcos; then
openstack image create rhcos --container-format bare --disk-format qcow2 --public --file $RHCOS_IMAGE_FILENAME
Expand Down
72 changes: 72 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,78 @@ OpenShift Installer OpenStack Dev Scripts

# Instructions

## 0) Pre installation

Enable the appropriate openstack repo, by looking at the output of

`sudo yum search release-openstack`

and installing the desired repositories for the release you want to use. For example:

`sudo yum install centos-release-openstack-rocky`

Install OpenStack client

`sudo yum install python2-openstackclient`

Install git

`sudo yum install git`

Configure stack user to use the correct version of ansible.

For example, 2.9 does not support the "failed" filter, so you might have to switch to a lower version.

Do it at the root level because some of the playbooks run
under root, so just changing it at the user level will not be enough.

`sudo pip uninstall ansible`

`sudo pip install "ansible==2.8.7"`

`ansible --version`

Clone this repository:

`cd <to_wherever_you_want_this_source_code_to_live`

`git clone <this repos address>`


CD to repo

`cd ocp-doit`

Get the lastest artifacts hash for the tripleo if you want to use it, and set it in common.sh.
You can get it from:

` https://trunk.rdoproject.org/centos7/current-tripleo/commit.yaml`

by joining the `commit_hash` and the first 8 characters of the `distro_hash` with a `_`.
For example:

commit_hash: 38c4e3104abdeb4699cfbe7a78fa2f37d7a863b4
distgit_dir: /home/centos-master-uc/data/puppet-manila_distro/
distro_hash: 93bde36c78d20a482068674c1391725cdf89b6d9

becomes:

`38c4e3104abdeb4699cfbe7a78fa2f37d7a863b4_93bde36c`

Install and configure a dns server on the host machine (The machine with the LOCAL_IP address). The LOCAL_IP
address is used as the forwarder for the Neutron dnsmasq and other dns services.

Dnsmasq is probably a good enough solution.

Example of /etc/dnsmasq.conf on LOCAL_IP machine, which makes machine use 192.168.122.1 as a forwarder

domain-needed
bogus-priv
server=192.168.122.1
conf-dir=/etc/dnsmasq.d,.rpmnew,.rpmsave,.rpmo

Now the LOCAL_IP machine will respond to DNS queries using dnsmasq, and it will forward requests to 192.168.122.1 if needed.

## 1) Create local config

Create a config file based on the example and set values appropriate for your
Expand Down
2 changes: 1 addition & 1 deletion common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export OPENSHIFT_INSTALL_RELEASE_IMAGE_OVERRIDE="registry.svc.ci.openshift.org/o
# We'll have to check once in a while for a new version though.
# You can get the latest hash here:
# https://trunk.rdoproject.org/centos7/current-tripleo/commit.yaml
TRIPLEO_VERSION='25698ebfff692178450478b5207b09ca99d277b2_aba8ec54'
TRIPLEO_VERSION='38c4e3104abdeb4699cfbe7a78fa2f37d7a863b4_93bde36c'

# Use some color to highlight actionable output
highlight() {
Expand Down
21 changes: 21 additions & 0 deletions get-rhcos-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,24 @@ echo "Downloading RHCOS image from:"
echo "$IMAGE_URL"

curl --insecure --compressed -L -O "$IMAGE_URL"

IMAGE_NAME=$(echo "${IMAGE_URL##*/}")

gzip -l $IMAGE_NAME >/dev/null 2>&1

# Lets check to see if file is compressed with gzip
# and uncompress it if so
if [[ $? -eq 0 ]]
then
echo "$IMAGE_NAME is compressed. Expanding..."
gunzip -f $IMAGE_NAME
IMAGE_NAME="${IMAGE_NAME%.gz}"
fi

# Save image with user specified name.
if [ "$#" -eq 1 ]
then
mv $IMAGE_NAME ${1}
IMAGE_NAME=${1}
fi
echo File saved as $IMAGE_NAME