-
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.
Refactored repository role, changes for RHEL (#547)
* Refactored repository role, changes for RHEL #536 * Changed directories structure for tasks #536 * Added repository role to feature mappings #536 * Fix for removing flag file if expired #536 * Added wget #536
- Loading branch information
Showing
38 changed files
with
141 additions
and
111 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.
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.
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.
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 |
File renamed without changes.
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
19 changes: 19 additions & 0 deletions
19
core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/RedHat/setup.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
- name: Create epirepo repository | ||
shell: >- | ||
/tmp/epi-repository-setup-scripts/create-repository.sh /var/www/html/epirepo {{ offline_mode }} |& | ||
tee /tmp/epi-repository-setup-scripts/create-repository.log | ||
when: | ||
- not custom_repository_url | ||
- inventory_hostname in groups['repository'] | ||
|
||
- name: Disable system repositories and set up epirepo | ||
block: | ||
- name: Create list of enabled repositories | ||
shell: /tmp/epi-repository-setup-scripts/create-enabled-system-repos-list.sh | ||
- name: Disable system repositories | ||
shell: /tmp/epi-repository-setup-scripts/disable-system-repos.sh | ||
- name: Add and enable epirepo | ||
shell: >- | ||
/tmp/epi-repository-setup-scripts/add-epirepo-client.sh {{ repository_url }} |& | ||
tee /tmp/epi-repository-setup-scripts/add-epirepo-client.log |
12 changes: 12 additions & 0 deletions
12
core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/RedHat/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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Re-enable system repositories | ||
shell: /tmp/epi-repository-setup-scripts/enable-system-repos.sh | ||
|
||
- name: Disable epirepo | ||
shell: /tmp/epi-repository-setup-scripts/disable-epirepo-client.sh | ||
|
||
- name: Disable epirepo server | ||
shell: /tmp/epi-repository-setup-scripts/disable-repository-server.sh | ||
when: | ||
- not custom_repository_url | ||
- inventory_hostname in groups['repository'] |
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_result.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 |
19 changes: 0 additions & 19 deletions
19
core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/setup-RedHat.yml
This file was deleted.
Oops, something went wrong.
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
20 changes: 0 additions & 20 deletions
20
core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/teardown-RedHat.yml
This file was deleted.
Oops, something went wrong.
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: "{{ ansible_os_family }}/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
Oops, something went wrong.