-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow running repoclosure based on a URL and dist
- Loading branch information
Showing
9 changed files
with
148 additions
and
50 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
23 changes: 23 additions & 0 deletions
23
obal/data/roles/repoclosure/tasks/downloaded_rpms_repoclosure.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,23 @@ | ||
--- | ||
- name: Find all downloaded repositories | ||
find: | ||
paths: "{{ inventory_dir }}/downloaded_rpms" | ||
recurse: false | ||
file_type: directory | ||
register: downloaded_rpms_folders | ||
|
||
- name: Map repositories to dists | ||
set_fact: | ||
downloaded_rpms_dists: "{{ downloaded_rpms_folders.files | map(attribute='path') | map('basename') | list }}" | ||
|
||
- name: Include repoclosure | ||
ansible.builtin.include_tasks: | ||
file: repoclosure.yml | ||
vars: | ||
download_rpm_repos: "{{ dict([['name', 'downloaded_rpms'], ['url', inventory_dir + '/downloaded_rpms/' + dist]]) }}" | ||
check_repos: "{{ repoclosure_target_repos[dist] | default([]) + ['downloaded_rpms'] }}" | ||
additional_repos: "{{ repoclosure_additional_repos + [download_rpm_repos] }}" | ||
lookaside_repos: "{{ repoclosure_lookaside_repos[dist] }}" | ||
loop: "{{ downloaded_rpms_dists }}" | ||
loop_control: | ||
loop_var: dist |
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,34 @@ | ||
--- | ||
- name: Find all downloaded repositories | ||
find: | ||
paths: "{{ inventory_dir }}/downloaded_rpms" | ||
recurse: false | ||
file_type: directory | ||
register: downloaded_rpms_folders | ||
|
||
- name: Map repositories to dists | ||
set_fact: | ||
downloaded_rpms_dists: "{{ downloaded_rpms_folders.files | map(attribute='path') | map('basename') | list }}" | ||
|
||
- name: Run repoclosure for all dists | ||
include_tasks: repoclosure.yml | ||
vars: | ||
repoclosure_use_downloaded_rpms: true | ||
loop: "{{ downloaded_rpms_dists }}" | ||
loop_control: | ||
loop_var: dist | ||
include_tasks: downloaded_rpms_repoclosure.yml | ||
when: | ||
- downloaded_rpms_dists | ||
- repoclosure_target_dist is not defined | ||
- not repoclosure_check_repos | ||
|
||
- name: Run repoclosure for main repo | ||
include_tasks: repoclosure.yml | ||
vars: | ||
repoclosure_use_downloaded_rpms: false | ||
loop: | ||
- "{{ repoclosure_target_dist }}" | ||
loop_control: | ||
loop_var: dist | ||
vars: | ||
check_repos: "{{ repoclosure_target_repos[dist] }}" | ||
lookaside_repos: "{{ repoclosure_lookaside_repos[dist] }}" | ||
additional_repos: [] | ||
when: | ||
- repoclosure_target_dist is defined | ||
- not repoclosure_check_repos | ||
|
||
- name: Run repoclosure for a target repo | ||
include_tasks: repoclosure.yml | ||
loop: | ||
- "{{ repoclosure_check_repos }}" | ||
loop_control: | ||
loop_var: repo_url | ||
index_var: index | ||
vars: | ||
check_repos: "{{ 'repo' + index|string }}" | ||
lookaside_repos: "{{ repoclosure_lookaside_repos[repoclosure_target_dist] }}" | ||
additional_repos: "{{ [{'name': 'repo' + index|string, 'url': repo_url}] }}" | ||
when: | ||
- repoclosure_check_repos |
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,64 @@ | ||
- block: | ||
- name: Generate downloaded_rpms dictionary for additional repositories | ||
set_fact: | ||
download_rpm_repos: "{{ dict([['name', 'downloaded_rpms'], ['url', inventory_dir + '/downloaded_rpms/' + dist]]) }}" | ||
when: downloaded_rpms_dists | ||
|
||
- name: Generate list of repositories | ||
set_fact: | ||
repoclosure_target_repos_all: "{{ repoclosure_target_repos[dist] | default([]) + ['downloaded_rpms'] }}" | ||
when: downloaded_rpms_dists | ||
|
||
- name: Generate list of repositories | ||
set_fact: | ||
repoclosure_target_repos_all: "{{ repoclosure_target_repos[dist] }}" | ||
when: not downloaded_rpms_dists | ||
|
||
- name: Set additional_repos | ||
set_fact: | ||
additional_repos: "{{ repoclosure_additional_repos + [download_rpm_repos] }}" | ||
when: download_rpm_repos is defined | ||
|
||
- name: Set additional_repos | ||
set_fact: | ||
additional_repos: "{{ repoclosure_additional_repos }}" | ||
when: download_rpm_repos is not defined | ||
|
||
- name: Set config filename for repoclosure | ||
set_fact: | ||
config_filename: "{{ repoclosure_config | basename }}" | ||
|
||
- name: Create temp directory | ||
tempfile: | ||
state: directory | ||
suffix: repoclosure | ||
register: temp_directory | ||
|
||
- name: Copy repoclosure config to temp directory | ||
copy: | ||
src: "{{ inventory_dir }}/{{ repoclosure_config }}" | ||
dest: "{{ temp_directory.path }}/{{ config_filename }}" | ||
remote_src: true | ||
mode: '0640' | ||
|
||
- name: Replace cachedir with temp directory | ||
replace: | ||
path: "{{ temp_directory.path }}/{{ config_filename }}" | ||
regexp: "^cachedir.*" | ||
replace: "cachedir={{ temp_directory.path }}" | ||
|
||
- name: 'Run repoclosure for {{ dist }}' | ||
repoclosure: | ||
config: "{{ temp_directory.path }}/{{ config_filename }}" | ||
check: "{{ repoclosure_target_repos_all }}" | ||
additional_repos: "{{ additional_repos }}" | ||
lookaside: "{{ repoclosure_lookaside_repos[dist] }}" | ||
register: output | ||
|
||
- debug: | ||
msg: "{{ output.output }}" | ||
always: | ||
- name: Clean up temporary directory | ||
file: | ||
state: absent | ||
path: "{{ temp_directory.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
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