-
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 tasks to serve gating repo over content provider
Signed-off-by: Chandan Kumar <[email protected]>
- Loading branch information
Showing
6 changed files
with
76 additions
and
2 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
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
37 changes: 37 additions & 0 deletions
37
roles/build_openstack_packages/tasks/serve_gating_repo.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,37 @@ | ||
--- | ||
- name: Install python-psutil | ||
become: true | ||
ansible.builtin.package: | ||
name: python-psutil | ||
|
||
- name: Getting process IDs of the process | ||
community.general.pids: | ||
pattern: "python -m http.server" | ||
register: pids_of_python | ||
|
||
- name: Printing the process IDs obtained | ||
ansible.builtin.debug: | ||
msg: "{{ pids_of_python.pids }}" | ||
|
||
- name: Force kill the running process | ||
ansible.builtin.command: "kill -9 {{ item }}" | ||
loop: "{{ pids_of_python.pids }}" | ||
|
||
- name: Open port 8766 to serve repos | ||
become: true | ||
ansible.builtin.command: "{{ item }}" | ||
with_items: | ||
- "nft add table ip filter" | ||
- "nft add chain ip filter INPUT { type filter hook input priority 0 \\; }" | ||
- "nft insert rule ip filter INPUT tcp dport 8766 counter accept" | ||
changed_when: true | ||
|
||
- name: Serve gating repos | ||
become: true | ||
ansible.builtin.shell: | ||
cmd: >- | ||
nohup python3 -m http.server 8766 1>{{ ansible_user_dir }}/pkg_mgr_mirror.log 2>{{ ansible_user_dir }}/pkg_mgr_mirror_error.log & | ||
args: | ||
chdir: "{{ cifmw_bop_gating_repo_dest }}" | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
- name: Check for gating.repo file on content provider | ||
ansible.builtin.uri: | ||
url: "http://{{ content_provider_registry_ip }}:8766/gating.repo" | ||
register: _url_status | ||
ignore_errors: true | ||
|
||
- name: Construct gating repo | ||
when: _url_status.status == 200 | ||
block: | ||
- name: Populate gating repo from content provider ip | ||
ansible.builtin.copy: | ||
content: | | ||
[gating-repo] | ||
baseurl=http://{{ content_provider_registry_ip }}:8766/ | ||
enabled=1 | ||
gpgcheck=0 | ||
priority=1 | ||
dest: "{{ cifmw_repo_setup_output }}/gating.repo" | ||
|
||
- name: Check for DLRN repo at the destination | ||
ansible.builtin.stat: | ||
path: "{{ cifmw_repo_setup_output }}/delorean.repo" | ||
register: _dlrn_repo | ||
|
||
- name: Lower the priority of DLRN repos to allow installation from gating repo | ||
when: _dlrn_repo.stat.exists | ||
ansible.builtin.replace: | ||
path: "{{ cifmw_repo_setup_output }}/delorean.repo" | ||
regexp: "priority=1" | ||
replace: "priority=20" |