pynfs: Enable codeready-builder in AWS
PATCH 1/1 pynfs: Enable codeready-builder in AWS
From: Chuck Lever <[email protected]>
Running "make pynfs" against an AWS EC2 instance fails with:
Error: No matching repo to modify: codeready-builder-for-rhel-9-x86_64-rpms.
Adjust the logic in playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml to try to sketch in what we might need for running the pynfs in the cloud.
--- .../pynfs/tasks/install-deps/redhat/main.yml | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-)
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +38 -13
@@ -1,24 +1,49 @@ --- -- name: Enable the CodeReady repo - become: yes - command: /usr/bin/dnf config-manager --enable codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms +# name: Display all variables +# debug: +# var=vars + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-rhui-rpms" when: - - ansible_distribution == 'RedHat' + - kdevops_enable_terraform + - kdevops_terraform_provider == "aws" + - ansible_distribution == "RedHat" + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms" + when: + - not kdevops_enable_terraform + - ansible_distribution == "RedHat" + - not devconfig_custom_yum_repofile + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "crb" + when: + - not kdevops_enable_terraform + - ansible_distribution == "CentOS" - not devconfig_custom_yum_repofile - name: Enable the CodeReady repo - become: yes - command: /usr/bin/dnf config-manager --enable crb - when: - - ansible_distribution == 'CentOS' - - not devconfig_custom_yum_repofile + become: true + become_method: ansible.builtin.sudo + ansible.builtin.command: + argv: + - "/usr/bin/dnf" + - "config-manager" + - "--enable" + - "{{ nfsd_codeready_repo }}" - name: Install build dependencies for pynfs - become: yes - become_method: sudo - yum: - update_cache: yes + become: true + become_method: ansible.builtin.sudo + ansible.builtin.yum: + update_cache: true name: "{{ packages }}" + state: present retries: 3 delay: 5 register: result
Signature · 1 line
2.46.1
Quoted 21 lines · On Fri, 18 Oct 2024, [email protected] wrote:
From: Chuck Lever <[email protected]>
Running "make pynfs" against an AWS EC2 instance fails with:
Error: No matching repo to modify: codeready-builder-for-rhel-9-x86_64-rpms.
Adjust the logic in
playbooks/roles/pynfs/tasks/install-deps/redhat/main.ymlto try to sketch in what we might need for running the pynfs in the cloud.Signed-off-by Chuck Lever <[email protected]>--- .../pynfs/tasks/install-deps/redhat/main.yml | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-)playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +0
-0
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml line 4
Quoted 7 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +3
-3@@ -1,24 +1,49 @@ --- -- name: Enable the CodeReady repo - become: yes - command: /usr/bin/dnf config-manager --enable codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms +# name: Display all variables +# debug: +# var=vars
Probably should remove the debugging stuff before merging.
Quoted 30 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +22
-4+ +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-rhui-rpms" when: - - ansible_distribution == 'RedHat' + - kdevops_enable_terraform + - kdevops_terraform_provider == "aws" + - ansible_distribution == "RedHat" + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms" + when: + - not kdevops_enable_terraform + - ansible_distribution == "RedHat" + - not devconfig_custom_yum_repofile + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "crb" + when: + - not kdevops_enable_terraform + - ansible_distribution == "CentOS" - not devconfig_custom_yum_repofile - name: Enable the CodeReady repo - become: yes - command: /usr/bin/dnf config-manager --enable crb - when:
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml line 38
Quoted 10 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +8
-2- - ansible_distribution == 'CentOS' - - not devconfig_custom_yum_repofile + become: true + become_method: ansible.builtin.sudo + ansible.builtin.command: + argv: + - "/usr/bin/dnf" + - "config-manager" + - "--enable" + - "{{ nfsd_codeready_repo }}"
I'm not sure if this will work on my setups. I use devconfig_custom_yum_repofile in lieu of registering my systems because I'm usually testing bits that aren't in any official repos yet.
So nfsd_codeready_repo will be unset when it gets to this command and it'll just run 'dnf config-manager --enable'.
Quoted 19 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +5
-4- name: Install build dependencies for pynfs - become: yes - become_method: sudo - yum: - update_cache: yes + become: true + become_method: ansible.builtin.sudo + ansible.builtin.yum: + update_cache: true name: "{{ packages }}" + state: present retries: 3 delay: 5 register: resultSignature · 1 line
2.46.1
Quoted 27 lines · On Fri, 18 Oct 2024, [email protected] wrote:
From: Chuck Lever <[email protected]>
Running "make pynfs" against an AWS EC2 instance fails with:
Error: No matching repo to modify: codeready-builder-for-rhel-9-x86_64-rpms.
Adjust the logic in
playbooks/roles/pynfs/tasks/install-deps/redhat/main.ymlto try to sketch in what we might need for running the pynfs in the cloud.Signed-off-by Chuck Lever <[email protected]>--- .../pynfs/tasks/install-deps/redhat/main.yml | 51 ++++++++++++++----- 1 file changed, 38 insertions(+), 13 deletions(-)playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +2
-3@@ -1,24 +1,49 @@ --- -- name: Enable the CodeReady repo - become: yes - command: /usr/bin/dnf config-manager --enable codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms +# name: Display all variables +# debug:
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml line 12
Quoted 10 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +8
-1+# var=vars + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-rhui-rpms" when: - - ansible_distribution == 'RedHat' + - kdevops_enable_terraform + - kdevops_terraform_provider == "aws" + - ansible_distribution == "RedHat"
When I tested your patch I got:
---8<---
TASK [pynfs : Select the CodeReady repo to enable] *******************************************************************************************************************************************************************************************
fatal: [kdevops-pynfs-rhel-9-kotd-nfsd]: FAILED! => {}
MSG:
The conditional check 'kdevops_enable_terraform' failed. The error was: error while evaluating conditional (kdevops_enable_terraform): 'kdevops_enable_terraform' is undefined. 'kdevops_enable_terraform' is undefined
The error appears to be in '/home/buildbot/git/kdevops-pynfs-rhel-9-kotd/playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml': line 6, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Select the CodeReady repo to enable
^ here
---8<---
So I added "kdevops_enable_terraform: False" to playbooks/roles/pynfs/defaults/main.yml.
Quoted 21 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +15
-3+ +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms" + when: + - not kdevops_enable_terraform + - ansible_distribution == "RedHat" + - not devconfig_custom_yum_repofile + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "crb" + when: + - not kdevops_enable_terraform + - ansible_distribution == "CentOS" - not devconfig_custom_yum_repofile - name: Enable the CodeReady repo - become: yes - command: /usr/bin/dnf config-manager --enable crb - when:
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml line 38
Quoted 10 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +8
-2- - ansible_distribution == 'CentOS' - - not devconfig_custom_yum_repofile + become: true + become_method: ansible.builtin.sudo + ansible.builtin.command: + argv: + - "/usr/bin/dnf" + - "config-manager" + - "--enable" + - "{{ nfsd_codeready_repo }}"
And then here (I thought I sent an email about this last night but I can't find it in my sent folder):
---8<---
TASK [pynfs : Enable the CodeReady repo] *****************************************************************************************************************************************************************************************************
fatal: [kdevops-pynfs-rhel-9-kotd-nfsd]: FAILED! => {}
MSG:
The task includes an option with an undefined variable. The error was: 'nfsd_codeready_repo' is undefined. 'nfsd_codeready_repo' is undefined
The error appears to be in '/home/buildbot/git/kdevops-pynfs-rhel-9-kotd/playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml': line 30, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
- name: Enable the CodeReady repo
^ here
---8<---
This task needs when clause:
when:
- not devconfig_custom_yum_repofile
-Scott
Quoted 19 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +5
-4- name: Install build dependencies for pynfs - become: yes - become_method: sudo - yum: - update_cache: yes + become: true + become_method: ansible.builtin.sudo + ansible.builtin.yum: + update_cache: true name: "{{ packages }}" + state: present retries: 3 delay: 5 register: resultSignature · 1 line
2.46.1
playbooks/roles/pynfs/defaults/main.yml +1 -0
@@ -5,5 +5,6 @@ # We default to not run tests. kdevops_run_pynfs: False pynfs_pnfs_block: False +kdevops_enable_terraform: False pynfs_data: "{{ data_path }}/pynfs"
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +2 -0
@@ -36,6 +36,8 @@ - "config-manager" - "--enable" - "{{ nfsd_codeready_repo }}" + when: + - not devconfig_custom_yum_repofile - name: Install build dependencies for pynfs become: true
Quoted 57 lines · Scott Mayhew
Quoted 27 lines · On Fri, 18 Oct 2024, [email protected] wrote:
From: Chuck Lever <[email protected]>
Running "make pynfs" against an AWS EC2 instance fails with:
Error: No matching repo to modify: codeready-builder-for-rhel-9-x86_64-rpms.
Adjust the logic in
playbooks/roles/pynfs/tasks/install-deps/redhat/main.ymlto try to sketch in what we might need for running the pynfs in the cloud.Signed-off-by Chuck Lever <[email protected]>---
.../pynfs/tasks/install-deps/redhat/main.yml| 51 ++++++++++++++-----1 file changed, 38 insertions(+), 13 deletions(-)playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +2
-4@@ -1,24 +1,49 @@ --- -- name: Enable the CodeReady repo - become: yes - command: /usr/bin/dnf config-manager --enable codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms +# name: Display all variables +# debug:playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml line 11
Quoted 10 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +8
-1+# var=vars + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-rhui-rpms" when: - - ansible_distribution == 'RedHat' + - kdevops_enable_terraform + - kdevops_terraform_provider == "aws" + - ansible_distribution == "RedHat"When I tested your patch I got:
---8<---
TASK [pynfs : Select the CodeReady repo to enable] *******************************************************************************************************************************************************************************************
fatal: [kdevops-pynfs-rhel-9-kotd-nfsd]: FAILED! => {}MSG:
The conditional check '
kdevops_enable_terraform' failed. The error was: error while evaluating conditional (kdevops_enable_terraform): 'kdevops_enable_terraform' is undefined. 'kdevops_enable_terraform' is undefinedThe error appears to be in '
/home/buildbot/git/kdevops-pynfs-rhel-9-kotd/playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml': line 6, column 3, but may be elsewhere in the file depending on the exact syntax problem.
Quoted 9 lines
The offending line appears to be:
- name: Select the CodeReady repo to enable
^ here
---8<---So I added "
kdevops_enable_terraform: False" toplaybooks/roles/pynfs/defaults/main.yml.
I tested this patch with libvirt, didn't see that problem, though I did expect to.
Quoted 78 lines
Quoted 21 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +15
-4+ +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms" + when: + - not kdevops_enable_terraform + - ansible_distribution == "RedHat" + - not devconfig_custom_yum_repofile + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "crb" + when: + - not kdevops_enable_terraform + - ansible_distribution == "CentOS" - not devconfig_custom_yum_repofile - name: Enable the CodeReady repo - become: yes - command: /usr/bin/dnf config-manager --enable crb - when:playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml line 36
Quoted 10 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +8
-2- - ansible_distribution == 'CentOS' - - not devconfig_custom_yum_repofile + become: true + become_method: ansible.builtin.sudo + ansible.builtin.command: + argv: + - "/usr/bin/dnf" + - "config-manager" + - "--enable" + - "{{ nfsd_codeready_repo }}"And then here (I thought I sent an email about this last night but I can't find it in my sent folder):
---8<---
TASK [pynfs : Enable the CodeReady repo] *****************************************************************************************************************************************************************************************************
fatal: [kdevops-pynfs-rhel-9-kotd-nfsd]: FAILED! => {}MSG:
The task includes an option with an undefined variable. The error was: '
nfsd_codeready_repo' is undefined. 'nfsd_codeready_repo' is undefinedThe error appears to be in '
/home/buildbot/git/kdevops-pynfs-rhel-9-kotd/playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml': line 30, column 3, but may be elsewhere in the file depending on the exact syntax problem.The offending line appears to be:
- name: Enable the CodeReady repo
^ here
---8<---This task needs when clause:
when:
- notdevconfig_custom_yum_repofile-Scott
Quoted 19 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +5
-5- name: Install build dependencies for pynfs - become: yes - become_method: sudo - yum: - update_cache: yes + become: true + become_method: ansible.builtin.sudo + ansible.builtin.yum: + update_cache: true name: "{{ packages }}" + state: present retries: 3 delay: 5 register: resultSignature · 1 line
2.46.1
Quoted 1 line
<fixup.patch>
Agreed, this patch needs more work. I thought I had tagged it with "RFC" before sending, but I guess I didn't actually do that.
--
Chuck Lever
Quoted 68 lines · Chuck Lever III
Quoted 65 lines · Scott Mayhew
Quoted 27 lines · On Fri, 18 Oct 2024, [email protected] wrote:
From: Chuck Lever <[email protected]>
Running "make pynfs" against an AWS EC2 instance fails with:
Error: No matching repo to modify: codeready-builder-for-rhel-9-x86_64-rpms.
Adjust the logic in
playbooks/roles/pynfs/tasks/install-deps/redhat/main.ymlto try to sketch in what we might need for running the pynfs in the cloud.Signed-off-by Chuck Lever <[email protected]>---
.../pynfs/tasks/install-deps/redhat/main.yml| 51 ++++++++++++++-----1 file changed, 38 insertions(+), 13 deletions(-)playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +2
-4@@ -1,24 +1,49 @@ --- -- name: Enable the CodeReady repo - become: yes - command: /usr/bin/dnf config-manager --enable codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms +# name: Display all variables +# debug:playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml line 11
Quoted 10 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +8
-1+# var=vars + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-rhui-rpms" when: - - ansible_distribution == 'RedHat' + - kdevops_enable_terraform + - kdevops_terraform_provider == "aws" + - ansible_distribution == "RedHat"When I tested your patch I got:
---8<---
TASK [pynfs : Select the CodeReady repo to enable] *******************************************************************************************************************************************************************************************
fatal: [kdevops-pynfs-rhel-9-kotd-nfsd]: FAILED! => {}MSG:
The conditional check '
kdevops_enable_terraform' failed. The error was: error while evaluating conditional (kdevops_enable_terraform): 'kdevops_enable_terraform' is undefined. 'kdevops_enable_terraform' is undefinedThe error appears to be in '
/home/buildbot/git/kdevops-pynfs-rhel-9-kotd/playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml': line 6, column 3, but may be elsewhere in the file depending on the exact syntax problem.The offending line appears to be:
- name: Select the CodeReady repo to enable
^ here
---8<---
Quoted 5 lines
Quoted 2 lines
So I added "
kdevops_enable_terraform: False" toplaybooks/roles/pynfs/defaults/main.yml.I tested this patch with libvirt, didn't see that problem, though I did expect to.
I think setting a default in pynfs/defaults/main.yml will make that variable always be false in pynfs/tasks/main.yml -- that default would likely "cover" the global version of that variable.
playbooks/roles/gen_nodes/defaults/main.yml has this:
kdevops_enable_guestfs: Falsekdevops_enable_terraform: Falsekdevops_enable_vagrant: Falsekdevops_enable_iscsi: false
This works for guestfs, vagrant, and iscsi, so I don't understand why terraform would be undefined.
--
Chuck Lever
Quoted 85 lines · Chuck Lever III
Quoted 69 lines · Chuck Lever III
Quoted 65 lines · Scott Mayhew
Quoted 33 lines · On Fri, 18 Oct 2024, [email protected] wrote:
From: Chuck Lever <[email protected]>
Running "make pynfs" against an AWS EC2 instance fails with:
Error: No matching repo to modify: codeready-builder-for-rhel-9-x86_64-rpms.
Adjust the logic in
playbooks/roles/pynfs/tasks/install-deps/redhat/main.ymlto try to sketch in what we might need for running the pynfs in the cloud.Signed-off-by Chuck Lever <[email protected]>---
.../pynfs/tasks/install-deps/redhat/main.yml| 51 ++++++++++++++-----1 file changed, 38 insertions(+), 13 deletions(-)playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +7
-4@@ -1,24 +1,49 @@ --- -- name: Enable the CodeReady repo - become: yes - command: /usr/bin/dnf config-manager --enable codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-{{ ansible_architecture }}-rpms +# name: Display all variables +# debug: +# var=vars + +- name: Select the CodeReady repo to enable + ansible.builtin.set_fact: + nfsd_codeready_repo: "codeready-builder-for-rhel-{{ ansible_distribution_major_version }}-rhui-rpms"when:
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml
Quoted 4 lines
playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml +3
-1- - ansible_distribution == 'RedHat' + - kdevops_enable_terraform + - kdevops_terraform_provider == "aws" + - ansible_distribution == "RedHat"When I tested your patch I got:
---8<---
TASK [pynfs : Select the CodeReady repo to enable] *******************************************************************************************************************************************************************************************
fatal: [kdevops-pynfs-rhel-9-kotd-nfsd]: FAILED! => {}MSG:
The conditional check '
kdevops_enable_terraform' failed. The error was: error while evaluating conditional (kdevops_enable_terraform): 'kdevops_enable_terraform' is undefined. 'kdevops_enable_terraform' is undefinedThe error appears to be in '
/home/buildbot/git/kdevops-pynfs-rhel-9-kotd/playbooks/roles/pynfs/tasks/install-deps/redhat/main.yml': line 6, column 3, but may be elsewhere in the file depending on the exact syntax problem.The offending line appears to be:
- name: Select the CodeReady repo to enable
^ here
---8<---Quoted 5 lines
Quoted 2 lines
So I added "
kdevops_enable_terraform: False" toplaybooks/roles/pynfs/defaults/main.yml.I tested this patch with libvirt, didn't see that problem, though I did expect to.
I think setting a default in
pynfs/defaults/main.ymlwill make that variable always be false inpynfs/tasks/main.yml-- that default would likely "cover" the global version of that variable.
playbooks/roles/gen_nodes/defaults/main.ymlhas this:
Quoted 7 lines
kdevops_enable_guestfs: Falsekdevops_enable_terraform: Falsekdevops_enable_vagrant: Falsekdevops_enable_iscsi: falseThis works for guestfs, vagrant, and iscsi, so I don't understand why terraform would be undefined.
Adding the default setting as your patch did seems to work fine, so I went with that.
However, it looks like there are a couple of other codereadybuilder consumers in kdevops, and they have the same problem as pynfs when running on AWS.
My inclination is to extract the Ansible logic that installs CRB into a separate role that handles the AWS case properly.
--
Chuck Lever