Skip to content

Commit

Permalink
Refactor prepare.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
pratik705 committed Jun 20, 2024
1 parent cf7893f commit 3e98a32
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 77 deletions.
58 changes: 0 additions & 58 deletions scripts/osp17-prep.sh

This file was deleted.

35 changes: 16 additions & 19 deletions scripts/prepare.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
#!/bin/bash

egrep -i 'Centos|RedHat' /etc/redhat-release 2>/dev/null && isRH=1
egrep -i 'Centos|Red Hat' /etc/redhat-release 2>/dev/null && isRH=1

# Install some dependancies
if [ $isRH ]; then
rpm -qi python3-pip python3-virtualenv > /dev/null
test $? -ne 0 && dnf -y install python3-pip python3-virtualenv
echo "Notes:
- Make sure OSP repositories are enabled on all the nodes.
- Please read the documentation and update /opt/rpc-maas/user_maas_variables.yml config file and set up any entities and agents as needed.
"

# Update the python alternatives if needed
if [ ! -e /usr/bin/python ]; then
alternatives --set python /usr/bin/python3
fi
# Install some dependancies
rpm -qi python3-pip > /dev/null
if [ $? != 0 ]; then
dnf -y install python3-pip
fi
else
apt install -y python3-pip virtualenv
apt install -y python3-pip
fi

# Create the virtual environment
if [ ! -d /root/ansible_venv ] || [ ! -f /root/ansible_venv/bin/python3 ]; then
if [ ! -d /root/ansible_venv ]; then

# Set up the python virtual env
rm -rf /root/ansible_venv
virtualenv -p /usr/bin/python3 /root/ansible_venv --system-site-packages
python3 -m venv --system-site-packages /root/ansible_venv

fi

# Install required packages
Expand All @@ -44,19 +48,12 @@ if [[ "$PUBCLOUD_USERNAME" != "" ]] && [[ "$PUBCLOUD_API_KEY" != "" ]] && [[ "$P
fi
fi

# Bomb if the /home/stack/user_maas_variables.yml doesn't exist.
if [ ! -e /home/stack/user_maas_variables.yml ]; then
echo
echo "Please read the documentation and create the /home/stack/user_maas_variables.yml config file and set up any entities and agents as needed."
echo
fi

echo
echo "Example Playbook Usage Post Configuration:
cd /opt/rpc-maas/
. /root/ansible_venv/bin/activate"
if [ $isRH ]; then
echo "ansible-playbook -i /opt/rpc-maas/inventory/rpcr_dynamic_inventory.py -e @/home/stack/user_maas_variables.yml playbooks/site.yml"
echo "ansible-playbook -i /opt/rpc-maas/inventory/inventory.py -i /home/stack/tripleo-deploy/undercloud/tripleo-ansible-inventory.yaml -i /home/stack/overcloud-deploy/<stack>/tripleo-ansible-inventory.yaml -e @/opt/rpc-maas/user_maas_variables.yml -f 75 playbooks/site.yml --ssh-common-args='-o StrictHostKeyChecking=no' --private-key /home/stack/.ssh/id_rsa"
else
echo ". /usr/local/bin/openstack-ansible.rc"
echo "# When present add the Ceph inventory to update the maas checks on"
Expand Down

0 comments on commit 3e98a32

Please sign in to comment.