-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add offline/online mode for Red Hat (#519)
- Loading branch information
Showing
3 changed files
with
55 additions
and
41 deletions.
There are no files selected for viewing
32 changes: 10 additions & 22 deletions
32
...ta/common/ansible/playbooks/roles/repository/files/RedHat/scripts/create-repository-rh.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,21 @@ | ||
#!/bin/bash | ||
|
||
PACKAGE_LIST=$(cat $1) | ||
LOG_FILE=/root/script-execution.log | ||
EPIPHANY_FILES_LOCATION=$1; | ||
OFFLINE_MODE=$2; | ||
LOG_FILE=/root/script-execution.log; | ||
|
||
WWW_SERVER_PATH=/var/www/html; | ||
|
||
REPOSITORY_PATH=$WWW_SERVER_PATH/repos; | ||
FILES_PATH=$WWW_SERVER_PATH/files; | ||
IMAGES_PATH=$WWW_SERVER_PATH/images; | ||
if $OFFLINE_MODE = true; | ||
then | ||
rpm -i $EPIPHANY_FILES_LOCATION/offline_prereqs/*.rpm; | ||
else | ||
yum install -y httpd createrepo yum-utils; | ||
fi | ||
|
||
mkdir -p $WWW_SERVER_PATH; | ||
mkdir -p $REPOSITORY_PATH; | ||
mkdir -p $FILES_PATH; | ||
mkdir -p $IMAGES_PATH; | ||
|
||
yum install -y httpd createrepo yum-utils; | ||
|
||
for package in $PACKAGE_LIST ; do | ||
echo "========== $package =========" | tee $LOG_FILE; | ||
repoquery -a --qf '%{ui_nevra}' $package; | ||
repoquery -a --qf '%{ui_nevra}' $package | xargs yumdownloader --destdir $REPOSITORY_PATH | tee $LOG_FILE; | ||
echo "========== $package - dependencies =========" | tee $LOG_FILE; | ||
repoquery -R --resolve -a --qf '%{ui_nevra}' $package; | ||
repoquery -R --resolve -a --qf '%{ui_nevra}' $package | xargs yumdownloader --destdir $REPOSITORY_PATH | tee $LOG_FILE; | ||
done | ||
mv $EPIPHANY_FILES_LOCATION/* $WWW_SERVER_PATH; | ||
|
||
setenforce 0; | ||
systemctl start httpd; | ||
|
||
createrepo $REPOSITORY_PATH; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 15 additions & 6 deletions
21
core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/teardown-RedHat.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,20 @@ | ||
--- | ||
|
||
- name: Enable system repositories | ||
shell: /tmp/{{ ansible_os_family }}/enable-system-repos.sh | ||
- name: Enable system repositories and disable epirepo for offline mode | ||
block: | ||
- name: Enable system repositories | ||
shell: /tmp/{{ ansible_os_family }}/enable-system-repos.sh | ||
- name: Disable epirepo on clients | ||
shell: /tmp/{{ ansible_os_family }}/disable-epirepo-client-rh.sh | ||
when: | ||
- not groups['kubernetes_master'][0] == inventory_hostname | ||
- offline_mode == true | ||
|
||
- name: Disable epirepo on clients | ||
shell: /tmp/{{ ansible_os_family }}/disable-epirepo-client-rh.sh | ||
- name: Disable system repositories and setup epirepo for online mode | ||
block: | ||
- name: Enable system repositories | ||
shell: /tmp/{{ ansible_os_family }}/enable-system-repos.sh | ||
- name: Disable epirepo on clients | ||
shell: /tmp/{{ ansible_os_family }}/disable-epirepo-client-rh.sh | ||
when: | ||
- not groups['kubernetes_master'][0] == inventory_hostname | ||
- not groups['kubernetes_master'][0] == inventory_hostname | ||
- offline_mode == false |