-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
executable file
·74 lines (65 loc) · 1.89 KB
/
install.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
#!/usr/bin/env bash
# Install Ansible AWX on RHEL 9
# Author:
# - Red Hat, Inc.
# - Ansible, Inc.
# - Community Contributors
# License: GPLv3
# Reference:
# -
# -
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
if [[ ! -f /etc/redhat-release ]]; then
echo "This script only supports RHEL 9"
exit 1
fi
if [[ $1 != "--fast" ]]; then
if [[ $ORG == "" ]]; then
echo "Please set the ORG environment variable"
exit 1
fi
if [[ $activationkey == "" ]]; then
echo "Please set the activationkey environment variable"
exit 1
fi
subscription-manager register --org $ORG --activationkey $activationkey
if [[ $? -eq 64 ]]; then
echo "system already subscribed skipping registration"
else
subscription-manager attach
subscription-manager repos --enable ansible-2.9-for-rhel-9-x86_64-rpms
subscription-manager repos --enable codeready-builder-for-rhel-9-x86_64-rpms
# Install Python3 and Ansible
sudo dnf install -y python3
sudo dnf install -y python3-pip
sudo dnf install -y python3-devel
sudo dnf install -y gcc
sudo dnf install -y git
sudo dnf install -y openssl-devel
sudo dnf install -y libselinux-python3
sudo dnf install -y libffi-devel
sudo dnf install -y redhat-rpm-config
sudo dnf install -y libsemanage-python3
sudo dnf install -y libxml2-devel
sudo dnf install -y libxslt-devel
sudo dnf install -y zlib-devel
sudo dnf install -y nodejs
sudo dnf install -y npm
sudo dnf install -y gettext
fi
fi
# Create Python3 Virtual Environment
python3 -m venv /usr/local/venv
# Install Ansible
source /usr/local/venv/bin/activate
pip install --upgrade pip
pip install ansible
pip install virtualenv
pip install uwsgi
# Install Ansible AWX
ansible-galaxy collection install --force ansible.posix
ansible-galaxy role install -fr roles/requirements.yml
ansible-playbook awxrpm.yml