From 08d66b3ab9979f67e5fc97285b8bd0205dd3a422 Mon Sep 17 00:00:00 2001 From: Jeffrey Cutter Date: Fri, 26 Apr 2024 17:17:50 +0800 Subject: [PATCH 1/4] Add support for passing environment variables to convert2rhel during the convert process. --- roles/convert/defaults/main.yml | 1 + roles/convert/tasks/main.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/roles/convert/defaults/main.yml b/roles/convert/defaults/main.yml index df4dffb..813577f 100644 --- a/roles/convert/defaults/main.yml +++ b/roles/convert/defaults/main.yml @@ -2,6 +2,7 @@ # defaults file for convert convert_convert2rhel_opts: "" +convert_convert2rhel_env_vars: "" # If you are converting to RHEL 8.8 and have an Extended Upgrade Support (EUS), add the --eus option by setting this variable to true. convert_convert2rhel_eus: false convert_convert2rhel_repos_enabled: [] diff --git a/roles/convert/tasks/main.yml b/roles/convert/tasks/main.yml index cdbf7b9..a6dfc5d 100644 --- a/roles/convert/tasks/main.yml +++ b/roles/convert/tasks/main.yml @@ -6,7 +6,7 @@ - name: Convert2RHEL convert ansible.builtin.shell: > - export PATH={{ convert_os_path }}; + export PATH={{ convert_os_path }} {{ convert_convert2rhel_env_vars }}; set -o pipefail; convert2rhel convert -y {{ convert_convert2rhel_opts }} From 45bce58962a4c35fa55f77472c5b5ba97bba07f6 Mon Sep 17 00:00:00 2001 From: Jeffrey Cutter Date: Fri, 26 Apr 2024 17:18:10 +0800 Subject: [PATCH 2/4] Update README. --- roles/convert/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/roles/convert/README.md b/roles/convert/README.md index 0ae3878..715dabd 100644 --- a/roles/convert/README.md +++ b/roles/convert/README.md @@ -11,6 +11,7 @@ Role Variables | Name | Type | Default value | Description | |-----------------------|------|-------------------------|-------------------------------------------------| | convert_convert2rhel_opts | String | | Optional string to define command line options to be passed to the `convert2rhel` command when running the conversion. | +| convert_convert2rhel_env_vars | String | | Optional string to define shell environment variables for the `convert2rhel` command when running the conversion. For example "CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS=1". Multiple env vars can be provided space separated. | | convert_convert2rhel_eus | Boolean | false | If you are converting to RHEL 8.8 and have an Extended Upgrade Support (EUS), add the --eus option by setting this variable to true. | | convert_convert2rhel_repos_enabled | List | [] | List of repositories to enable on the target node | | convert_convert2rhel_repos_disabled | List | [] | List of repositories to disable on the target node | From e6bd44ad245ca10232828c889b98695d7786be2e Mon Sep 17 00:00:00 2001 From: Jeffrey Cutter Date: Fri, 26 Apr 2024 17:18:19 +0800 Subject: [PATCH 3/4] Add changelog fragent. --- changelogs/fragments/allow_env_vars_for_convert.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelogs/fragments/allow_env_vars_for_convert.yml diff --git a/changelogs/fragments/allow_env_vars_for_convert.yml b/changelogs/fragments/allow_env_vars_for_convert.yml new file mode 100644 index 0000000..32fb80e --- /dev/null +++ b/changelogs/fragments/allow_env_vars_for_convert.yml @@ -0,0 +1,4 @@ +--- +minor_changes: + - Add convert_convert2rhel_env_vars variable to pass environment variables to convert2rhel during convert. +... From e6272829e1d9512b6ebfc232124268bc95754906 Mon Sep 17 00:00:00 2001 From: Jeffrey Cutter Date: Fri, 3 May 2024 15:55:24 +0800 Subject: [PATCH 4/4] Use task environment dict instead of appending to path export. --- roles/convert/README.md | 2 +- roles/convert/defaults/main.yml | 6 +++++- roles/convert/tasks/main.yml | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/roles/convert/README.md b/roles/convert/README.md index 715dabd..79ed3c3 100644 --- a/roles/convert/README.md +++ b/roles/convert/README.md @@ -11,7 +11,7 @@ Role Variables | Name | Type | Default value | Description | |-----------------------|------|-------------------------|-------------------------------------------------| | convert_convert2rhel_opts | String | | Optional string to define command line options to be passed to the `convert2rhel` command when running the conversion. | -| convert_convert2rhel_env_vars | String | | Optional string to define shell environment variables for the `convert2rhel` command when running the conversion. For example "CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS=1". Multiple env vars can be provided space separated. | +| convert_convert2rhel_env_vars | Dict | {} | Optional dictionary to define shell environment variables for the `convert2rhel` command when running the conversion. See defaults/main.yml for an example. | | convert_convert2rhel_eus | Boolean | false | If you are converting to RHEL 8.8 and have an Extended Upgrade Support (EUS), add the --eus option by setting this variable to true. | | convert_convert2rhel_repos_enabled | List | [] | List of repositories to enable on the target node | | convert_convert2rhel_repos_disabled | List | [] | List of repositories to disable on the target node | diff --git a/roles/convert/defaults/main.yml b/roles/convert/defaults/main.yml index 813577f..329a717 100644 --- a/roles/convert/defaults/main.yml +++ b/roles/convert/defaults/main.yml @@ -2,7 +2,11 @@ # defaults file for convert convert_convert2rhel_opts: "" -convert_convert2rhel_env_vars: "" +convert_convert2rhel_env_vars: {} +# convert_convert2rhel_env_vars: +# CONVERT2RHEL_ALLOW_UNAVAILABLE_KMODS: 1 +# CONVERT2RHEL_SKIP_KERNEL_CURRENCY_CHECK: 1 + # If you are converting to RHEL 8.8 and have an Extended Upgrade Support (EUS), add the --eus option by setting this variable to true. convert_convert2rhel_eus: false convert_convert2rhel_repos_enabled: [] diff --git a/roles/convert/tasks/main.yml b/roles/convert/tasks/main.yml index a6dfc5d..f6ec82b 100644 --- a/roles/convert/tasks/main.yml +++ b/roles/convert/tasks/main.yml @@ -6,7 +6,7 @@ - name: Convert2RHEL convert ansible.builtin.shell: > - export PATH={{ convert_os_path }} {{ convert_convert2rhel_env_vars }}; + export PATH={{ convert_os_path }}; set -o pipefail; convert2rhel convert -y {{ convert_convert2rhel_opts }} @@ -23,6 +23,7 @@ register: convert2rhel args: executable: /bin/bash + environment: "{{ convert_convert2rhel_env_vars }}" async: "{{ convert_async_timeout_maximum | int }}" poll: "{{ convert_async_poll_interval | int }}" changed_when: convert2rhel.rc != 0