Skip to content

Commit

Permalink
centos7 support for toolset
Browse files Browse the repository at this point in the history
  • Loading branch information
xpillons committed Jun 13, 2022
1 parent fb9e2e7 commit 3ade936
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ansible_prereqs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#!/bin/bash
set -e
ANSIBLE_VERSION=5.8.0
ANSIBLE_VERSION_UBUNTU=5.8.0
ANSIBLE_VERSION_CENTOS=4.10.0

os_release=$(cat /etc/os-release | grep "^ID\=" | cut -d'=' -f 2 | xargs)
os_release=${os_release^^}

THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

if [[ `pip3 list pypsrp` == *"pypsrp"* ]]; then
Expand Down Expand Up @@ -36,7 +41,8 @@ fi
ansible --version
pip3 list | grep ansible
version=$(pip3 list | grep ansible | sort | head -n 1 | xargs | cut -d' ' -f 2)
if [ "$version" != $ANSIBLE_VERSION ]; then
echo "Ansible version is $ansible_version. Please run ./toolset/scripts/install.sh to install the correct version of Ansible"
ANSIBLE_VERSION="ANSIBLE_VERSION_$os_release"
if [ "$version" != ${!ANSIBLE_VERSION} ]; then
echo "Ansible version is ${!ANSIBLE_VERSION}. Please run ./toolset/scripts/install.sh to install the correct version of Ansible"
exit 1
fi
109 changes: 109 additions & 0 deletions toolset/scripts/install_centos.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
#!/bin/bash
# Install basic command-line utilities
yum install -y epel-release

yum install -y \
curl \
python3 \
python3-pip \
jq \
wget \
git \
yamllint

#
# Install AzCLI
#
echo "Installing AzCLI ..."
rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo -e "[azure-cli]
name=Azure CLI
baseurl=https://packages.microsoft.com/yumrepos/azure-cli
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc" | tee /etc/yum.repos.d/azure-cli.repo
yum install -y azure-cli

#
# Install AzCopy
#
echo "Installing AzCopy ..."
cd /usr/local/bin
wget -q https://aka.ms/downloadazcopy-v10-linux -O - | tar zxf - --strip-components 1 --wildcards '*/azcopy'
chmod 755 /usr/local/bin/azcopy
#
# Install Ansible
#
echo "Installing Ansible ..."
yum remove -y ansible
pip3 install setuptools-rust
pip3 install --upgrade pip
pip3 install ansible==4.10.0

echo "Installing Ansible playbooks pre-reqs"
pip3 install pypsrp
pip3 install PySocks

ansible-galaxy collection install ansible.windows
ansible-galaxy collection install community.windows
ansible-galaxy collection install ansible.posix
ansible-galaxy collection install community.general

#
# Install Terraform
#
echo "Installing terraform ..."
#apt update -y && \
#apt install -y software-properties-common && \
yum -y remove terraform
yum install -y yum-utils
yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
yum -y install terraform

#
# Install Packer
#
echo "Installing packer...."
yum remove packer -y
yum install -y packer

#
# Install yq
#
echo "Installing yq...."
VERSION=v4.13.3
BINARY=yq_linux_amd64
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY} -O /usr/bin/yq && chmod +x /usr/bin/yq

# Clean-up
rm -f /tmp/*.zip && rm -f /tmp/*.gz && \

echo "=============="
echo "Python version"
echo "=============="
python3 --version
echo "==============="
echo "Ansible version"
echo "==============="
ansible --version
echo "================="
echo "Terraform version"
echo "================="
terraform --version
echo "=============="
echo "Packer version"
echo "=============="
/usr/bin/packer --version
echo "=========="
echo "AZ version"
echo "=========="
az --version
echo "=========="
echo "AZ Copy version"
echo "=========="
azcopy --version
echo "=========="
echo "yq version"
echo "=========="
yq --version
echo "End"

0 comments on commit 3ade936

Please sign in to comment.