forked from hitachienergy/epiphany
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored repository role, changes for RHEL hitachienergy#536
- Loading branch information
Showing
31 changed files
with
110 additions
and
93 deletions.
There are no files selected for viewing
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 1 addition & 4 deletions
5
...repository/RedHat/setup-epirepo-client.sh → ...files/client/RedHat/add-epirepo-client.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
7 changes: 7 additions & 0 deletions
7
...nsible/playbooks/roles/repository/files/client/RedHat/create-enabled-system-repos-list.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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash -eu | ||
|
||
ENABLED_REPOS_FILE=/tmp/enabled-system-repos.txt | ||
|
||
if [ ! -f "$ENABLED_REPOS_FILE" ]; then | ||
yum repolist -v enabled | grep -i Repo-id | awk -F ":" '{print $2}' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | awk -F "/" '{print $1}' > $ENABLED_REPOS_FILE | ||
fi |
5 changes: 5 additions & 0 deletions
5
...a/common/ansible/playbooks/roles/repository/files/client/RedHat/disable-epirepo-client.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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash -eu | ||
|
||
yum-config-manager --disable epirepo | ||
yum makecache | ||
yum repolist |
10 changes: 10 additions & 0 deletions
10
...ata/common/ansible/playbooks/roles/repository/files/client/RedHat/disable-system-repos.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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash -eu | ||
|
||
REPOS_LIST_FILE=/tmp/enabled-system-repos.txt | ||
|
||
cat $REPOS_LIST_FILE | while read repository | ||
do | ||
echo "Disabling repository: $repository" | ||
yum-config-manager --disable $repository | ||
done | ||
|
9 changes: 9 additions & 0 deletions
9
...data/common/ansible/playbooks/roles/repository/files/client/RedHat/enable-system-repos.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash -eu | ||
|
||
REPOS_LIST_FILE=/tmp/enabled-system-repos.txt | ||
|
||
cat $REPOS_LIST_FILE | while read repository | ||
do | ||
echo "Enabling repository: $repository" | ||
yum-config-manager --enable $repository | ||
done |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions
4
...books/roles/repository/files/repository/RedHat/create-enabled-system-repositories-list.sh
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...ta/common/ansible/playbooks/roles/repository/files/repository/RedHat/create-repository.sh
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
...mmon/ansible/playbooks/roles/repository/files/repository/RedHat/disable-epirepo-client.sh
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
...a/common/ansible/playbooks/roles/repository/files/repository/RedHat/disable-repository.sh
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
...common/ansible/playbooks/roles/repository/files/repository/RedHat/disable-system-repos.sh
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
.../common/ansible/playbooks/roles/repository/files/repository/RedHat/enable-system-repos.sh
This file was deleted.
Oops, something went wrong.
File renamed without changes.
15 changes: 15 additions & 0 deletions
15
...i/data/common/ansible/playbooks/roles/repository/files/server/RedHat/create-repository.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash -eu | ||
|
||
EPI_REPO_SERVER_PATH=$1 # /var/www/html/epirepo is the default | ||
IS_OFFLINE_MODE=$2 | ||
|
||
if $IS_OFFLINE_MODE = true; then | ||
yum install -y $(ls $EPI_REPO_SERVER_PATH/packages/offline_prereqs/*.rpm) #TODO: to test | ||
else | ||
yum install -y httpd createrepo yum-utils | ||
fi | ||
|
||
setenforce 0 | ||
systemctl start httpd | ||
|
||
createrepo $EPI_REPO_SERVER_PATH/packages |
4 changes: 4 additions & 0 deletions
4
...ommon/ansible/playbooks/roles/repository/files/server/RedHat/disable-repository-server.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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash -eu | ||
|
||
systemctl stop httpd | ||
systemctl disable httpd |
20 changes: 18 additions & 2 deletions
20
...src/epicli/data/common/ansible/playbooks/roles/repository/tasks/download-requirements.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,15 +1,31 @@ | ||
--- | ||
# download-requirements-done.flag file is used to avoid re-downloading requirements (to save time) | ||
# this is to be optimized in the future | ||
|
||
- name: Check if flag file exists | ||
stat: | ||
path: /tmp/epi-download-requirements/download-requirements-done.flag | ||
register: stat_result | ||
|
||
- name: Remove download-requirements-done.flag file if expired | ||
file: | ||
path: /tmp/epi-download-requirements/download-requirements-done.flag | ||
state: absent | ||
when: | ||
- stat_result.stat.exists | ||
- (ansible_date_time.epoch|int - stat_results.stat.mtime) > 3600 # older than 1h | ||
|
||
- name: Check whether to run download script | ||
stat: | ||
path: /tmp/epi-download-requirements/download-requirements-done.flag | ||
register: stat_result | ||
|
||
- name: Run download-requirements script, it can take a long time | ||
shell: /tmp/epi-download-requirements/download-requirements.sh /var/www/html/epirepo | ||
when: stat_result.stat.exists == False | ||
when: not stat_result.stat.exists | ||
|
||
- name: Create flag file to not re-download requirements next time | ||
file: | ||
path: /tmp/epi-download-requirements/download-requirements-done.flag | ||
state: touch | ||
when: stat_result.stat.exists == False | ||
when: not stat_result.stat.exists |
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
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
24 changes: 8 additions & 16 deletions
24
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,20 +1,12 @@ | ||
--- | ||
- name: Re-enable system repositories | ||
shell: /tmp/epi-repository-setup-scripts/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: | ||
- offline_mode == true | ||
- name: Disable epirepo | ||
shell: /tmp/epi-repository-setup-scripts/disable-epirepo-client.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 | ||
- name: Disable epirepo server | ||
shell: /tmp/epi-repository-setup-scripts/disable-repository-server.sh | ||
when: | ||
- not groups['kubernetes_master'][0] == inventory_hostname | ||
- offline_mode == false | ||
- not custom_repository_url | ||
- inventory_hostname in groups['repository'] |
4 changes: 2 additions & 2 deletions
4
core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/teardown.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,2 +1,2 @@ | ||
- name: Configure repository and clients | ||
include_tasks: "teardown-{{ ansible_os_family }}.yml" | ||
- name: Re-enable system repositories and disable epirepo | ||
include_tasks: teardown-{{ ansible_os_family }}.yml |