|
1 | 1 | --- |
2 | 2 | - when: ansible_pkg_mgr == 'dnf' |
3 | 3 | block: |
| 4 | + - name: Compute facts (DNF) |
| 5 | + ansible.builtin.set_fact: |
| 6 | + opennebula_repo_pre_enable: >- |
| 7 | + {{ opennebula_repo_pre_enable_defaults | combine(opennebula_repo_pre_enable | d({}), recursive=true) }} |
| 8 | +
|
4 | 9 | - name: Enable required DNF extra repos |
5 | 10 | ansible.builtin.shell: |
6 | 11 | cmd: | |
7 | 12 | set -o errexit |
8 | | - {{ _script[ansible_distribution][ansible_distribution_major_version] }} |
| 13 | +
|
| 14 | + {% if _config_manager | count > 0 %} |
| 15 | + dnf config-manager -y --enable {{ _config_manager | map('regex_replace', '^(.*)$', "'\g<1>'") | join(' ') }} |
| 16 | + {% endif %} |
| 17 | +
|
| 18 | + {% if _subscription_manager | count > 0 %} |
| 19 | + subscription-manager repos {{ _subscription_manager | map('regex_replace', '^(.*)$', "--enable '\g<1>'") | join(' ') }} |
| 20 | + {% endif %} |
9 | 21 | executable: /bin/bash |
10 | 22 | changed_when: false |
11 | 23 | vars: |
12 | | - _script: |
13 | | - AlmaLinux: |
14 | | - '8': | |
15 | | - dnf config-manager -y --enable epel powertools ha |
16 | | - '9': | |
17 | | - dnf config-manager -y --enable epel crb highavailability |
18 | | - RedHat: |
19 | | - '8': | |
20 | | - dnf config-manager -y --enable epel |
21 | | - subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms \ |
22 | | - --enable rhel-8-for-x86_64-highavailability-rpms |
23 | | - '9': | |
24 | | - dnf config-manager -y --enable epel |
25 | | - subscription-manager repos --enable codeready-builder-for-rhel-9-x86_64-rpms \ |
26 | | - --enable rhel-9-for-x86_64-highavailability-rpms |
| 24 | + _config_manager: >- |
| 25 | + {{ opennebula_repo_pre_enable[ansible_distribution].config_manager[ansible_distribution_major_version] |
| 26 | + | d([]) |
| 27 | + | map('replace', "'", '') }} |
| 28 | + _subscription_manager: >- |
| 29 | + {{ opennebula_repo_pre_enable[ansible_distribution].subscription_manager[ansible_distribution_major_version] |
| 30 | + | d([]) |
| 31 | + | map('replace', "'", '') }} |
27 | 32 |
|
28 | 33 | - vars: |
29 | 34 | # Merge repository config with defaults. |
|
0 commit comments