* [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml @ 2025-05-18 14:18 cel 2025-05-18 14:18 ` [PATCH v1 2/2] bootlinux: Fold bootlinux-local into the bootlinux role cel 2025-05-19 9:13 ` [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml Daniel Gomez 0 siblings, 2 replies; 9+ messages in thread From: cel @ 2025-05-18 14:18 UTC (permalink / raw) To: kdevops; +Cc: Daniel Gomez, Chuck Lever From: Chuck Lever <chuck.lever@oracle.com> This subrole is run using include_tasks, but install-deps/main.yml then imports the distribution-specific steps. It's better to avoid mixing import_tasks and include_tasks. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- .../bootlinux/tasks/install-deps/main.yml | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/playbooks/roles/bootlinux/tasks/install-deps/main.yml b/playbooks/roles/bootlinux/tasks/install-deps/main.yml index c4c16d20509c..2931f9fe06e3 100644 --- a/playbooks/roles/bootlinux/tasks/install-deps/main.yml +++ b/playbooks/roles/bootlinux/tasks/install-deps/main.yml @@ -1,8 +1,15 @@ --- -- name: oscheck distribution ospecific setup - import_tasks: debian/main.yml - when: ansible_facts['os_family']|lower == 'debian' -- import_tasks: suse/main.yml - when: ansible_facts['os_family']|lower == 'suse' -- import_tasks: redhat/main.yml - when: ansible_facts['os_family']|lower == 'redhat' +- name: Debian-specific setup + ansible.builtin.include_tasks: debian/main.yml + when: + - ansible_os_family == "Debian" + +- name: SuSE-specific setup + ansible.builtin.include_tasks: suse/main.yml + when: + - ansible_os_family == "Suse" + +- name: Red Hat-specific setup + ansible.builtin.include_tasks: redhat/main.yml + when: + - ansible_os_family == "RedHat" -- 2.49.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH v1 2/2] bootlinux: Fold bootlinux-local into the bootlinux role 2025-05-18 14:18 [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml cel @ 2025-05-18 14:18 ` cel 2025-05-19 9:32 ` Daniel Gomez 2025-05-19 9:13 ` [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml Daniel Gomez 1 sibling, 1 reply; 9+ messages in thread From: cel @ 2025-05-18 14:18 UTC (permalink / raw) To: kdevops; +Cc: Daniel Gomez, Chuck Lever From: Chuck Lever <chuck.lever@oracle.com> Rather than running a separate play, adopt the more common mechanism for running a local action. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> --- playbooks/bootlinux-local.yml | 5 ----- .../roles/bootlinux-local/defaults/main.yml | 3 --- .../roles/bootlinux-local/tasks/install-deps | 1 - .../roles/bootlinux-local/tasks/main.yml | 19 ---------------- playbooks/roles/bootlinux/tasks/main.yml | 22 ++++++++++++++++--- workflows/linux/Makefile | 3 --- 6 files changed, 19 insertions(+), 34 deletions(-) delete mode 100644 playbooks/bootlinux-local.yml delete mode 100644 playbooks/roles/bootlinux-local/defaults/main.yml delete mode 120000 playbooks/roles/bootlinux-local/tasks/install-deps delete mode 100644 playbooks/roles/bootlinux-local/tasks/main.yml diff --git a/playbooks/bootlinux-local.yml b/playbooks/bootlinux-local.yml deleted file mode 100644 index e342f0e56fb1..000000000000 --- a/playbooks/bootlinux-local.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - connection: local - roles: - - role: bootlinux-local diff --git a/playbooks/roles/bootlinux-local/defaults/main.yml b/playbooks/roles/bootlinux-local/defaults/main.yml deleted file mode 100644 index d7c41f4c3e90..000000000000 --- a/playbooks/roles/bootlinux-local/defaults/main.yml +++ /dev/null @@ -1,3 +0,0 @@ -# SPDX-License-Identifier copyleft-next-0.3.1 ---- -bootlinux_9p: False diff --git a/playbooks/roles/bootlinux-local/tasks/install-deps b/playbooks/roles/bootlinux-local/tasks/install-deps deleted file mode 120000 index 492aaaa0174a..000000000000 --- a/playbooks/roles/bootlinux-local/tasks/install-deps +++ /dev/null @@ -1 +0,0 @@ -../../bootlinux/tasks/install-deps/ \ No newline at end of file diff --git a/playbooks/roles/bootlinux-local/tasks/main.yml b/playbooks/roles/bootlinux-local/tasks/main.yml deleted file mode 100644 index 367b3af46ec6..000000000000 --- a/playbooks/roles/bootlinux-local/tasks/main.yml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: Import optional extra_args file - include_vars: "{{ item }}" - ignore_errors: yes - with_first_found: - - files: - - "../extra_vars.yml" - - "../extra_vars.yaml" - - "../extra_vars.json" - skip: true - tags: vars - -- name: Install dependencies to build Linux on host - tags: [ 'deps' ] - run_once: true - local_action: import_tasks install-deps/main.yml - when: - - bootlinux_9p|bool - diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/roles/bootlinux/tasks/main.yml index 9ad675b3f278..3741b16aa33c 100644 --- a/playbooks/roles/bootlinux/tasks/main.yml +++ b/playbooks/roles/bootlinux/tasks/main.yml @@ -10,11 +10,23 @@ skip: true tags: vars -# Distro specific -- name: Install dependencies - include_tasks: +- name: Install dependencies to build and install the Linux kernel + ansible.builtin.include_tasks: file: install-deps/main.yml +# Needs root on the controller +# +# Someday this should be done only once when installing kdevops +# on the Ansible control node. +- name: Install dependencies to build the Linux kernel + run_once: true + ansible.builtin.include_tasks: + file: install-deps/main.yml + apply: + delegate_to: localhost + when: + - bootlinux_9p|bool + # We do this regardless of what distro you use - name: Install b4 become: yes @@ -28,6 +40,10 @@ - ansible_facts['os_family']|lower != 'debian' tags: linux +# Needs root on the controller +# +# Someday this should be done only once when installing kdevops +# on the Ansible control node. - name: Install b4 on host become: yes become_method: sudo diff --git a/workflows/linux/Makefile b/workflows/linux/Makefile index ecce273a4f67..aaf604a1071a 100644 --- a/workflows/linux/Makefile +++ b/workflows/linux/Makefile @@ -90,9 +90,6 @@ LINUX_HELP_EXTRA := PHONY += linux linux: $(KDEVOPS_NODES) - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ - $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux-local.yml \ - --extra-vars="$(BOOTLINUX_ARGS)" $(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \ $(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \ --extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) -- 2.49.0 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v1 2/2] bootlinux: Fold bootlinux-local into the bootlinux role 2025-05-18 14:18 ` [PATCH v1 2/2] bootlinux: Fold bootlinux-local into the bootlinux role cel @ 2025-05-19 9:32 ` Daniel Gomez 2025-05-19 13:15 ` Chuck Lever 0 siblings, 1 reply; 9+ messages in thread From: Daniel Gomez @ 2025-05-19 9:32 UTC (permalink / raw) To: cel, kdevops; +Cc: Chuck Lever On 18/05/2025 16.18, cel@kernel.org wrote: > From: Chuck Lever <chuck.lever@oracle.com> > > Rather than running a separate play, adopt the more common mechanism > for running a local action. > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > --- > playbooks/bootlinux-local.yml | 5 ----- > .../roles/bootlinux-local/defaults/main.yml | 3 --- > .../roles/bootlinux-local/tasks/install-deps | 1 - > .../roles/bootlinux-local/tasks/main.yml | 19 ---------------- > playbooks/roles/bootlinux/tasks/main.yml | 22 ++++++++++++++++--- > workflows/linux/Makefile | 3 --- > 6 files changed, 19 insertions(+), 34 deletions(-) > delete mode 100644 playbooks/bootlinux-local.yml > delete mode 100644 playbooks/roles/bootlinux-local/defaults/main.yml > delete mode 120000 playbooks/roles/bootlinux-local/tasks/install-deps > delete mode 100644 playbooks/roles/bootlinux-local/tasks/main.yml > > diff --git a/playbooks/bootlinux-local.yml b/playbooks/bootlinux-local.yml > deleted file mode 100644 > index e342f0e56fb1..000000000000 > --- a/playbooks/bootlinux-local.yml > +++ /dev/null > @@ -1,5 +0,0 @@ > ---- > -- hosts: localhost > - connection: local > - roles: > - - role: bootlinux-local > diff --git a/playbooks/roles/bootlinux-local/defaults/main.yml b/playbooks/roles/bootlinux-local/defaults/main.yml > deleted file mode 100644 > index d7c41f4c3e90..000000000000 > --- a/playbooks/roles/bootlinux-local/defaults/main.yml > +++ /dev/null > @@ -1,3 +0,0 @@ > -# SPDX-License-Identifier copyleft-next-0.3.1 > ---- > -bootlinux_9p: False > diff --git a/playbooks/roles/bootlinux-local/tasks/install-deps b/playbooks/roles/bootlinux-local/tasks/install-deps > deleted file mode 120000 > index 492aaaa0174a..000000000000 > --- a/playbooks/roles/bootlinux-local/tasks/install-deps > +++ /dev/null > @@ -1 +0,0 @@ > -../../bootlinux/tasks/install-deps/ > \ No newline at end of file > diff --git a/playbooks/roles/bootlinux-local/tasks/main.yml b/playbooks/roles/bootlinux-local/tasks/main.yml > deleted file mode 100644 > index 367b3af46ec6..000000000000 > --- a/playbooks/roles/bootlinux-local/tasks/main.yml > +++ /dev/null > @@ -1,19 +0,0 @@ > ---- > -- name: Import optional extra_args file > - include_vars: "{{ item }}" > - ignore_errors: yes > - with_first_found: > - - files: > - - "../extra_vars.yml" > - - "../extra_vars.yaml" > - - "../extra_vars.json" > - skip: true > - tags: vars > - > -- name: Install dependencies to build Linux on host > - tags: [ 'deps' ] > - run_once: true > - local_action: import_tasks install-deps/main.yml > - when: > - - bootlinux_9p|bool > - > diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/roles/bootlinux/tasks/main.yml > index 9ad675b3f278..3741b16aa33c 100644 > --- a/playbooks/roles/bootlinux/tasks/main.yml > +++ b/playbooks/roles/bootlinux/tasks/main.yml > @@ -10,11 +10,23 @@ > skip: true > tags: vars > > -# Distro specific > -- name: Install dependencies > - include_tasks: > +- name: Install dependencies to build and install the Linux kernel > + ansible.builtin.include_tasks: > file: install-deps/main.yml > Same comment as in the other patch. Either we are missing deps tags here, at the Makefile target and at task level (and replace it with the current linux tag) or just remove all of them. > +# Needs root on the controller > +# > +# Someday this should be done only once when installing kdevops > +# on the Ansible control node. > +- name: Install dependencies to build the Linux kernel > + run_once: true > + ansible.builtin.include_tasks: > + file: install-deps/main.yml > + apply: > + delegate_to: localhost > + when: > + - bootlinux_9p|bool > + > # We do this regardless of what distro you use > - name: Install b4 > become: yes > @@ -28,6 +40,10 @@ > - ansible_facts['os_family']|lower != 'debian' > tags: linux > > +# Needs root on the controller > +# > +# Someday this should be done only once when installing kdevops > +# on the Ansible control node. @yawn_brendan shared this idea of running kdevops inside LXC with kvm support. Otherwise, host setup may become a bit complex to do it manually. Thoughts? > - name: Install b4 on host > become: yes > become_method: sudo > diff --git a/workflows/linux/Makefile b/workflows/linux/Makefile > index ecce273a4f67..aaf604a1071a 100644 > --- a/workflows/linux/Makefile > +++ b/workflows/linux/Makefile > @@ -90,9 +90,6 @@ LINUX_HELP_EXTRA := > > PHONY += linux > linux: $(KDEVOPS_NODES) > - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ > - $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux-local.yml \ > - --extra-vars="$(BOOTLINUX_ARGS)" > $(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \ > $(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \ > --extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 2/2] bootlinux: Fold bootlinux-local into the bootlinux role 2025-05-19 9:32 ` Daniel Gomez @ 2025-05-19 13:15 ` Chuck Lever 2025-05-19 13:38 ` Daniel Gomez 0 siblings, 1 reply; 9+ messages in thread From: Chuck Lever @ 2025-05-19 13:15 UTC (permalink / raw) To: da.gomez, kdevops; +Cc: Chuck Lever On 5/19/25 5:32 AM, Daniel Gomez wrote: > > > On 18/05/2025 16.18, cel@kernel.org wrote: >> From: Chuck Lever <chuck.lever@oracle.com> >> >> Rather than running a separate play, adopt the more common mechanism >> for running a local action. >> >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >> --- >> playbooks/bootlinux-local.yml | 5 ----- >> .../roles/bootlinux-local/defaults/main.yml | 3 --- >> .../roles/bootlinux-local/tasks/install-deps | 1 - >> .../roles/bootlinux-local/tasks/main.yml | 19 ---------------- >> playbooks/roles/bootlinux/tasks/main.yml | 22 ++++++++++++++++--- >> workflows/linux/Makefile | 3 --- >> 6 files changed, 19 insertions(+), 34 deletions(-) >> delete mode 100644 playbooks/bootlinux-local.yml >> delete mode 100644 playbooks/roles/bootlinux-local/defaults/main.yml >> delete mode 120000 playbooks/roles/bootlinux-local/tasks/install-deps >> delete mode 100644 playbooks/roles/bootlinux-local/tasks/main.yml >> >> diff --git a/playbooks/bootlinux-local.yml b/playbooks/bootlinux- >> local.yml >> deleted file mode 100644 >> index e342f0e56fb1..000000000000 >> --- a/playbooks/bootlinux-local.yml >> +++ /dev/null >> @@ -1,5 +0,0 @@ >> ---- >> -- hosts: localhost >> - connection: local >> - roles: >> - - role: bootlinux-local >> diff --git a/playbooks/roles/bootlinux-local/defaults/main.yml b/ >> playbooks/roles/bootlinux-local/defaults/main.yml >> deleted file mode 100644 >> index d7c41f4c3e90..000000000000 >> --- a/playbooks/roles/bootlinux-local/defaults/main.yml >> +++ /dev/null >> @@ -1,3 +0,0 @@ >> -# SPDX-License-Identifier copyleft-next-0.3.1 >> ---- >> -bootlinux_9p: False >> diff --git a/playbooks/roles/bootlinux-local/tasks/install-deps b/ >> playbooks/roles/bootlinux-local/tasks/install-deps >> deleted file mode 120000 >> index 492aaaa0174a..000000000000 >> --- a/playbooks/roles/bootlinux-local/tasks/install-deps >> +++ /dev/null >> @@ -1 +0,0 @@ >> -../../bootlinux/tasks/install-deps/ >> \ No newline at end of file >> diff --git a/playbooks/roles/bootlinux-local/tasks/main.yml b/ >> playbooks/roles/bootlinux-local/tasks/main.yml >> deleted file mode 100644 >> index 367b3af46ec6..000000000000 >> --- a/playbooks/roles/bootlinux-local/tasks/main.yml >> +++ /dev/null >> @@ -1,19 +0,0 @@ >> ---- >> -- name: Import optional extra_args file >> - include_vars: "{{ item }}" >> - ignore_errors: yes >> - with_first_found: >> - - files: >> - - "../extra_vars.yml" >> - - "../extra_vars.yaml" >> - - "../extra_vars.json" >> - skip: true >> - tags: vars >> - >> -- name: Install dependencies to build Linux on host >> - tags: [ 'deps' ] >> - run_once: true >> - local_action: import_tasks install-deps/main.yml >> - when: >> - - bootlinux_9p|bool >> - >> diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/ >> roles/bootlinux/tasks/main.yml >> index 9ad675b3f278..3741b16aa33c 100644 >> --- a/playbooks/roles/bootlinux/tasks/main.yml >> +++ b/playbooks/roles/bootlinux/tasks/main.yml >> @@ -10,11 +10,23 @@ >> skip: true >> tags: vars >> -# Distro specific >> -- name: Install dependencies >> - include_tasks: >> +- name: Install dependencies to build and install the Linux kernel >> + ansible.builtin.include_tasks: >> file: install-deps/main.yml >> > > Same comment as in the other patch. Either we are missing deps tags > here, at the Makefile target and at task level (and replace it with the > current linux tag) or just remove all of them. > >> +# Needs root on the controller >> +# >> +# Someday this should be done only once when installing kdevops >> +# on the Ansible control node. >> +- name: Install dependencies to build the Linux kernel >> + run_once: true >> + ansible.builtin.include_tasks: >> + file: install-deps/main.yml >> + apply: >> + delegate_to: localhost >> + when: >> + - bootlinux_9p|bool >> + >> # We do this regardless of what distro you use >> - name: Install b4 >> become: yes >> @@ -28,6 +40,10 @@ >> - ansible_facts['os_family']|lower != 'debian' >> tags: linux >> +# Needs root on the controller >> +# >> +# Someday this should be done only once when installing kdevops >> +# on the Ansible control node. > > @yawn_brendan shared this idea of running kdevops inside LXC with kvm > support. Otherwise, host setup may become a bit complex to do it manually. > > Thoughts? Where I'm going with this is to ultimately remove the use of "sudo" for all local actions. The biggest user of sudo for that purpose seems to be installing dependencies on the controller. That can instead be done when kdevops is installed. But LXC/kvm is outside of my everyday usage, so perhaps I don't understand @yawn_brendan's suggestion. >> - name: Install b4 on host >> become: yes >> become_method: sudo >> diff --git a/workflows/linux/Makefile b/workflows/linux/Makefile >> index ecce273a4f67..aaf604a1071a 100644 >> --- a/workflows/linux/Makefile >> +++ b/workflows/linux/Makefile >> @@ -90,9 +90,6 @@ LINUX_HELP_EXTRA := >> PHONY += linux >> linux: $(KDEVOPS_NODES) >> - $(Q)ansible-playbook $(ANSIBLE_VERBOSE) \ >> - $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux-local.yml \ >> - --extra-vars="$(BOOTLINUX_ARGS)" >> $(Q)ansible-playbook $(ANSIBLE_VERBOSE) -i \ >> $(KDEVOPS_HOSTFILE) $(KDEVOPS_PLAYBOOKS_DIR)/bootlinux.yml \ >> --extra-vars="$(BOOTLINUX_ARGS)" $(LIMIT_HOSTS) > -- Chuck Lever ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 2/2] bootlinux: Fold bootlinux-local into the bootlinux role 2025-05-19 13:15 ` Chuck Lever @ 2025-05-19 13:38 ` Daniel Gomez 2025-05-19 13:50 ` Chuck Lever 0 siblings, 1 reply; 9+ messages in thread From: Daniel Gomez @ 2025-05-19 13:38 UTC (permalink / raw) To: Chuck Lever, kdevops; +Cc: Chuck Lever On 19/05/2025 15.15, Chuck Lever wrote: > On 5/19/25 5:32 AM, Daniel Gomez wrote: >> >> >> On 18/05/2025 16.18, cel@kernel.org wrote: >>> From: Chuck Lever <chuck.lever@oracle.com> >>> >>> Rather than running a separate play, adopt the more common mechanism >>> for running a local action. >>> >>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >>> --- >>> playbooks/bootlinux-local.yml | 5 ----- >>> .../roles/bootlinux-local/defaults/main.yml | 3 --- >>> .../roles/bootlinux-local/tasks/install-deps | 1 - >>> .../roles/bootlinux-local/tasks/main.yml | 19 ---------------- >>> playbooks/roles/bootlinux/tasks/main.yml | 22 ++++++++++++++++--- >>> workflows/linux/Makefile | 3 --- >>> 6 files changed, 19 insertions(+), 34 deletions(-) >>> delete mode 100644 playbooks/bootlinux-local.yml >>> delete mode 100644 playbooks/roles/bootlinux-local/defaults/main.yml >>> delete mode 120000 playbooks/roles/bootlinux-local/tasks/install-deps >>> delete mode 100644 playbooks/roles/bootlinux-local/tasks/main.yml >>> >>> diff --git a/playbooks/bootlinux-local.yml b/playbooks/bootlinux- >>> local.yml >>> deleted file mode 100644 >>> index e342f0e56fb1..000000000000 >>> --- a/playbooks/bootlinux-local.yml >>> +++ /dev/null >>> @@ -1,5 +0,0 @@ >>> ---- >>> -- hosts: localhost >>> - connection: local >>> - roles: >>> - - role: bootlinux-local >>> diff --git a/playbooks/roles/bootlinux-local/defaults/main.yml b/ >>> playbooks/roles/bootlinux-local/defaults/main.yml >>> deleted file mode 100644 >>> index d7c41f4c3e90..000000000000 >>> --- a/playbooks/roles/bootlinux-local/defaults/main.yml >>> +++ /dev/null >>> @@ -1,3 +0,0 @@ >>> -# SPDX-License-Identifier copyleft-next-0.3.1 >>> ---- >>> -bootlinux_9p: False >>> diff --git a/playbooks/roles/bootlinux-local/tasks/install-deps b/ >>> playbooks/roles/bootlinux-local/tasks/install-deps >>> deleted file mode 120000 >>> index 492aaaa0174a..000000000000 >>> --- a/playbooks/roles/bootlinux-local/tasks/install-deps >>> +++ /dev/null >>> @@ -1 +0,0 @@ >>> -../../bootlinux/tasks/install-deps/ >>> \ No newline at end of file >>> diff --git a/playbooks/roles/bootlinux-local/tasks/main.yml b/ >>> playbooks/roles/bootlinux-local/tasks/main.yml >>> deleted file mode 100644 >>> index 367b3af46ec6..000000000000 >>> --- a/playbooks/roles/bootlinux-local/tasks/main.yml >>> +++ /dev/null >>> @@ -1,19 +0,0 @@ >>> ---- >>> -- name: Import optional extra_args file >>> - include_vars: "{{ item }}" >>> - ignore_errors: yes >>> - with_first_found: >>> - - files: >>> - - "../extra_vars.yml" >>> - - "../extra_vars.yaml" >>> - - "../extra_vars.json" >>> - skip: true >>> - tags: vars >>> - >>> -- name: Install dependencies to build Linux on host >>> - tags: [ 'deps' ] >>> - run_once: true >>> - local_action: import_tasks install-deps/main.yml >>> - when: >>> - - bootlinux_9p|bool >>> - >>> diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/ >>> roles/bootlinux/tasks/main.yml >>> index 9ad675b3f278..3741b16aa33c 100644 >>> --- a/playbooks/roles/bootlinux/tasks/main.yml >>> +++ b/playbooks/roles/bootlinux/tasks/main.yml >>> @@ -10,11 +10,23 @@ >>> skip: true >>> tags: vars >>> -# Distro specific >>> -- name: Install dependencies >>> - include_tasks: >>> +- name: Install dependencies to build and install the Linux kernel >>> + ansible.builtin.include_tasks: >>> file: install-deps/main.yml >>> >> >> Same comment as in the other patch. Either we are missing deps tags >> here, at the Makefile target and at task level (and replace it with the >> current linux tag) or just remove all of them. >> >>> +# Needs root on the controller >>> +# >>> +# Someday this should be done only once when installing kdevops >>> +# on the Ansible control node. >>> +- name: Install dependencies to build the Linux kernel >>> + run_once: true >>> + ansible.builtin.include_tasks: >>> + file: install-deps/main.yml >>> + apply: >>> + delegate_to: localhost >>> + when: >>> + - bootlinux_9p|bool >>> + >>> # We do this regardless of what distro you use >>> - name: Install b4 >>> become: yes >>> @@ -28,6 +40,10 @@ >>> - ansible_facts['os_family']|lower != 'debian' >>> tags: linux >>> +# Needs root on the controller >>> +# >>> +# Someday this should be done only once when installing kdevops >>> +# on the Ansible control node. >> >> @yawn_brendan shared this idea of running kdevops inside LXC with kvm >> support. Otherwise, host setup may become a bit complex to do it manually. >> >> Thoughts? > > Where I'm going with this is to ultimately remove the use of "sudo" for > all local actions. The biggest user of sudo for that purpose seems to be > installing dependencies on the controller. That can instead be done when > kdevops is installed. > I agree that would be great. But I'm not sure if that can apply to all workflows, setups, etc. That said, we should apply where we can. > But LXC/kvm is outside of my everyday usage, so perhaps I don't > understand @yawn_brendan's suggestion. We do more than installing dependencies with sudo. Like managing systemd services (user or system), configuring system wide stuff at /etc/*, etc. As an alternative to remove sudo, if we enable users to run kdevops inside a container with systemd like distrobox then, kdevops users would not be worried about what sudo does in that environment. At least, while we work on removing sudo. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 2/2] bootlinux: Fold bootlinux-local into the bootlinux role 2025-05-19 13:38 ` Daniel Gomez @ 2025-05-19 13:50 ` Chuck Lever 0 siblings, 0 replies; 9+ messages in thread From: Chuck Lever @ 2025-05-19 13:50 UTC (permalink / raw) To: da.gomez, kdevops; +Cc: Chuck Lever On 5/19/25 9:38 AM, Daniel Gomez wrote: > > > On 19/05/2025 15.15, Chuck Lever wrote: >> On 5/19/25 5:32 AM, Daniel Gomez wrote: >>> >>> >>> On 18/05/2025 16.18, cel@kernel.org wrote: >>>> From: Chuck Lever <chuck.lever@oracle.com> >>>> >>>> Rather than running a separate play, adopt the more common mechanism >>>> for running a local action. >>>> >>>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >>>> --- >>>> playbooks/bootlinux-local.yml | 5 ----- >>>> .../roles/bootlinux-local/defaults/main.yml | 3 --- >>>> .../roles/bootlinux-local/tasks/install-deps | 1 - >>>> .../roles/bootlinux-local/tasks/main.yml | 19 ---------------- >>>> playbooks/roles/bootlinux/tasks/main.yml | 22 ++++++++++++++ >>>> ++--- >>>> workflows/linux/Makefile | 3 --- >>>> 6 files changed, 19 insertions(+), 34 deletions(-) >>>> delete mode 100644 playbooks/bootlinux-local.yml >>>> delete mode 100644 playbooks/roles/bootlinux-local/defaults/main.yml >>>> delete mode 120000 playbooks/roles/bootlinux-local/tasks/install- >>>> deps >>>> delete mode 100644 playbooks/roles/bootlinux-local/tasks/main.yml >>>> >>>> diff --git a/playbooks/bootlinux-local.yml b/playbooks/bootlinux- >>>> local.yml >>>> deleted file mode 100644 >>>> index e342f0e56fb1..000000000000 >>>> --- a/playbooks/bootlinux-local.yml >>>> +++ /dev/null >>>> @@ -1,5 +0,0 @@ >>>> ---- >>>> -- hosts: localhost >>>> - connection: local >>>> - roles: >>>> - - role: bootlinux-local >>>> diff --git a/playbooks/roles/bootlinux-local/defaults/main.yml b/ >>>> playbooks/roles/bootlinux-local/defaults/main.yml >>>> deleted file mode 100644 >>>> index d7c41f4c3e90..000000000000 >>>> --- a/playbooks/roles/bootlinux-local/defaults/main.yml >>>> +++ /dev/null >>>> @@ -1,3 +0,0 @@ >>>> -# SPDX-License-Identifier copyleft-next-0.3.1 >>>> ---- >>>> -bootlinux_9p: False >>>> diff --git a/playbooks/roles/bootlinux-local/tasks/install-deps b/ >>>> playbooks/roles/bootlinux-local/tasks/install-deps >>>> deleted file mode 120000 >>>> index 492aaaa0174a..000000000000 >>>> --- a/playbooks/roles/bootlinux-local/tasks/install-deps >>>> +++ /dev/null >>>> @@ -1 +0,0 @@ >>>> -../../bootlinux/tasks/install-deps/ >>>> \ No newline at end of file >>>> diff --git a/playbooks/roles/bootlinux-local/tasks/main.yml b/ >>>> playbooks/roles/bootlinux-local/tasks/main.yml >>>> deleted file mode 100644 >>>> index 367b3af46ec6..000000000000 >>>> --- a/playbooks/roles/bootlinux-local/tasks/main.yml >>>> +++ /dev/null >>>> @@ -1,19 +0,0 @@ >>>> ---- >>>> -- name: Import optional extra_args file >>>> - include_vars: "{{ item }}" >>>> - ignore_errors: yes >>>> - with_first_found: >>>> - - files: >>>> - - "../extra_vars.yml" >>>> - - "../extra_vars.yaml" >>>> - - "../extra_vars.json" >>>> - skip: true >>>> - tags: vars >>>> - >>>> -- name: Install dependencies to build Linux on host >>>> - tags: [ 'deps' ] >>>> - run_once: true >>>> - local_action: import_tasks install-deps/main.yml >>>> - when: >>>> - - bootlinux_9p|bool >>>> - >>>> diff --git a/playbooks/roles/bootlinux/tasks/main.yml b/playbooks/ >>>> roles/bootlinux/tasks/main.yml >>>> index 9ad675b3f278..3741b16aa33c 100644 >>>> --- a/playbooks/roles/bootlinux/tasks/main.yml >>>> +++ b/playbooks/roles/bootlinux/tasks/main.yml >>>> @@ -10,11 +10,23 @@ >>>> skip: true >>>> tags: vars >>>> -# Distro specific >>>> -- name: Install dependencies >>>> - include_tasks: >>>> +- name: Install dependencies to build and install the Linux kernel >>>> + ansible.builtin.include_tasks: >>>> file: install-deps/main.yml >>>> >>> >>> Same comment as in the other patch. Either we are missing deps tags >>> here, at the Makefile target and at task level (and replace it with the >>> current linux tag) or just remove all of them. >>> >>>> +# Needs root on the controller >>>> +# >>>> +# Someday this should be done only once when installing kdevops >>>> +# on the Ansible control node. >>>> +- name: Install dependencies to build the Linux kernel >>>> + run_once: true >>>> + ansible.builtin.include_tasks: >>>> + file: install-deps/main.yml >>>> + apply: >>>> + delegate_to: localhost >>>> + when: >>>> + - bootlinux_9p|bool >>>> + >>>> # We do this regardless of what distro you use >>>> - name: Install b4 >>>> become: yes >>>> @@ -28,6 +40,10 @@ >>>> - ansible_facts['os_family']|lower != 'debian' >>>> tags: linux >>>> +# Needs root on the controller >>>> +# >>>> +# Someday this should be done only once when installing kdevops >>>> +# on the Ansible control node. >>> >>> @yawn_brendan shared this idea of running kdevops inside LXC with kvm >>> support. Otherwise, host setup may become a bit complex to do it >>> manually. >>> >>> Thoughts? >> >> Where I'm going with this is to ultimately remove the use of "sudo" for >> all local actions. The biggest user of sudo for that purpose seems to be >> installing dependencies on the controller. That can instead be done when >> kdevops is installed. >> > > I agree that would be great. But I'm not sure if that can apply to all > workflows, setups, etc. That said, we should apply where we can. Agreed. The process of finding and removing these will take some time, and the replacement mechanism doesn't yet exist (eg, packaging kdevops via RPM, say). >> But LXC/kvm is outside of my everyday usage, so perhaps I don't >> understand @yawn_brendan's suggestion. > > We do more than installing dependencies with sudo. Like managing systemd > services (user or system), configuring system wide stuff at /etc/*, etc. Yes. Luis also mentioned the use of the libvirt system URI. > As an alternative to remove sudo, if we enable users to run kdevops > inside a container with systemd like distrobox then, kdevops users would > not be worried about what sudo does in that environment. At least, while > we work on removing sudo. "sudo" on target nodes and in other environments that are managed by Ansible -- that's all OK. -- Chuck Lever ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml 2025-05-18 14:18 [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml cel 2025-05-18 14:18 ` [PATCH v1 2/2] bootlinux: Fold bootlinux-local into the bootlinux role cel @ 2025-05-19 9:13 ` Daniel Gomez 2025-05-19 13:11 ` Chuck Lever 1 sibling, 1 reply; 9+ messages in thread From: Daniel Gomez @ 2025-05-19 9:13 UTC (permalink / raw) To: cel, kdevops; +Cc: Chuck Lever On 18/05/2025 16.18, cel@kernel.org wrote: > From: Chuck Lever <chuck.lever@oracle.com> > > This subrole is run using include_tasks, but install-deps/main.yml > then imports the distribution-specific steps. It's better to avoid > mixing import_tasks and include_tasks. I agree. Ansible explains tag inheritance recommendation here: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_tags.html#tag-inheritance-for-includes-blocks-and-the-apply-keyword Can you add that to the commit message? > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com> > --- > .../bootlinux/tasks/install-deps/main.yml | 21 ++++++++++++------- > 1 file changed, 14 insertions(+), 7 deletions(-) > > diff --git a/playbooks/roles/bootlinux/tasks/install-deps/main.yml b/playbooks/roles/bootlinux/tasks/install-deps/main.yml > index c4c16d20509c..2931f9fe06e3 100644 > --- a/playbooks/roles/bootlinux/tasks/install-deps/main.yml > +++ b/playbooks/roles/bootlinux/tasks/install-deps/main.yml > @@ -1,8 +1,15 @@ > --- > -- name: oscheck distribution ospecific setup > - import_tasks: debian/main.yml > - when: ansible_facts['os_family']|lower == 'debian' > -- import_tasks: suse/main.yml > - when: ansible_facts['os_family']|lower == 'suse' > -- import_tasks: redhat/main.yml > - when: ansible_facts['os_family']|lower == 'redhat' > +- name: Debian-specific setup > + ansible.builtin.include_tasks: debian/main.yml > + when: > + - ansible_os_family == "Debian" In general, I think Ansible import is preferred for simplicity. The include_tasks module forces us to be explicit with the tags at 'include_*' task and at every included task level. Here, no tags are applied but debian/main.yml uses the linux tag. So if the playbook is run without specifying a tag (i.e. through linux Makefile target), I believe the file will be included but no tasks will be executed. Is that correct? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml 2025-05-19 9:13 ` [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml Daniel Gomez @ 2025-05-19 13:11 ` Chuck Lever 2025-05-19 13:51 ` Daniel Gomez 0 siblings, 1 reply; 9+ messages in thread From: Chuck Lever @ 2025-05-19 13:11 UTC (permalink / raw) To: da.gomez, kdevops; +Cc: Chuck Lever On 5/19/25 5:13 AM, Daniel Gomez wrote: > On 18/05/2025 16.18, cel@kernel.org wrote: >> From: Chuck Lever <chuck.lever@oracle.com> >> >> This subrole is run using include_tasks, but install-deps/main.yml >> then imports the distribution-specific steps. It's better to avoid >> mixing import_tasks and include_tasks. > > I agree. > > Ansible explains tag inheritance recommendation here: > https://docs.ansible.com/ansible/latest/playbook_guide/ > playbooks_tags.html#tag-inheritance-for-includes-blocks-and-the-apply- > keyword > > Can you add that to the commit message? Yes. >> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >> --- >> .../bootlinux/tasks/install-deps/main.yml | 21 ++++++++++++------- >> 1 file changed, 14 insertions(+), 7 deletions(-) >> >> diff --git a/playbooks/roles/bootlinux/tasks/install-deps/main.yml b/ >> playbooks/roles/bootlinux/tasks/install-deps/main.yml >> index c4c16d20509c..2931f9fe06e3 100644 >> --- a/playbooks/roles/bootlinux/tasks/install-deps/main.yml >> +++ b/playbooks/roles/bootlinux/tasks/install-deps/main.yml >> @@ -1,8 +1,15 @@ >> --- >> -- name: oscheck distribution ospecific setup >> - import_tasks: debian/main.yml >> - when: ansible_facts['os_family']|lower == 'debian' >> -- import_tasks: suse/main.yml >> - when: ansible_facts['os_family']|lower == 'suse' >> -- import_tasks: redhat/main.yml >> - when: ansible_facts['os_family']|lower == 'redhat' >> +- name: Debian-specific setup >> + ansible.builtin.include_tasks: debian/main.yml >> + when: >> + - ansible_os_family == "Debian" > > In general, I think Ansible import is preferred for simplicity. The > include_tasks module forces us to be explicit with the tags at > 'include_*' task and at every included task level. Here, no tags are > applied but debian/main.yml uses the linux tag. So if the playbook is > run without specifying a tag (i.e. through linux Makefile target), I > believe the file will be included but no tasks will be executed. Is that > correct? > The "linux" tag is not set by any invocation of this role. I have a patch that removes the tag completely. I can include that patch when I repost. I went back and forth about whether to stick with import_tasks or change to include_tasks, and I can't remember why I went with include_tasks. So right at the moment, I'm not stuck on either one or the other. -- Chuck Lever ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml 2025-05-19 13:11 ` Chuck Lever @ 2025-05-19 13:51 ` Daniel Gomez 0 siblings, 0 replies; 9+ messages in thread From: Daniel Gomez @ 2025-05-19 13:51 UTC (permalink / raw) To: Chuck Lever, kdevops; +Cc: Chuck Lever On 19/05/2025 15.11, Chuck Lever wrote: > On 5/19/25 5:13 AM, Daniel Gomez wrote: >> On 18/05/2025 16.18, cel@kernel.org wrote: >>> From: Chuck Lever <chuck.lever@oracle.com> >>> >>> This subrole is run using include_tasks, but install-deps/main.yml >>> then imports the distribution-specific steps. It's better to avoid >>> mixing import_tasks and include_tasks. >> >> I agree. >> >> Ansible explains tag inheritance recommendation here: >> https://docs.ansible.com/ansible/latest/playbook_guide/ >> playbooks_tags.html#tag-inheritance-for-includes-blocks-and-the-apply- >> keyword >> >> Can you add that to the commit message? > > Yes. > > >>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> >>> --- >>> .../bootlinux/tasks/install-deps/main.yml | 21 ++++++++++++------- >>> 1 file changed, 14 insertions(+), 7 deletions(-) >>> >>> diff --git a/playbooks/roles/bootlinux/tasks/install-deps/main.yml b/ >>> playbooks/roles/bootlinux/tasks/install-deps/main.yml >>> index c4c16d20509c..2931f9fe06e3 100644 >>> --- a/playbooks/roles/bootlinux/tasks/install-deps/main.yml >>> +++ b/playbooks/roles/bootlinux/tasks/install-deps/main.yml >>> @@ -1,8 +1,15 @@ >>> --- >>> -- name: oscheck distribution ospecific setup >>> - import_tasks: debian/main.yml >>> - when: ansible_facts['os_family']|lower == 'debian' >>> -- import_tasks: suse/main.yml >>> - when: ansible_facts['os_family']|lower == 'suse' >>> -- import_tasks: redhat/main.yml >>> - when: ansible_facts['os_family']|lower == 'redhat' >>> +- name: Debian-specific setup >>> + ansible.builtin.include_tasks: debian/main.yml >>> + when: >>> + - ansible_os_family == "Debian" >> >> In general, I think Ansible import is preferred for simplicity. The >> include_tasks module forces us to be explicit with the tags at >> 'include_*' task and at every included task level. Here, no tags are >> applied but debian/main.yml uses the linux tag. So if the playbook is >> run without specifying a tag (i.e. through linux Makefile target), I >> believe the file will be included but no tasks will be executed. Is that >> correct? >> > > The "linux" tag is not set by any invocation of this role. I have a > patch that removes the tag completely. I can include that patch when > I repost. Cool. > > I went back and forth about whether to stick with import_tasks or > change to include_tasks, and I can't remember why I went with > include_tasks. So right at the moment, I'm not stuck on either one or > the other. > > My understanding is that import_tasks allows you to not having to use tags inside the import_tasks YAML file. For example: - name: Import tasks import_tasks: tasks/deps/debian/main.yml tags: [ 'tag1', 'tag2', 'tag3'] Tags are evaluated at the "Import tasks" task. We don't need to specify them in debian/main.yml. So, in tasks/deps/debian/main.yml, we can write: - name: Task1 debug: msg: "Task1" - name: Task2 debug: msg: "Task2" - name: Task3 debug: msg: "Task3" However, if we want debian/main.yml to run task1 with tag1, and so on. We need the include_task module. And write the tags at both levels. So, for simple sub-roles we can stick with import_tasks. For this case, I'd stick with import_tasks module and remove any tag inside. And apply the necessary tags at the import_task task level. I hope I'm not missing anything. I can't remember if there was a special case where tags were described at task level but no tags were supplied with --tags. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-05-19 13:51 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-05-18 14:18 [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml cel 2025-05-18 14:18 ` [PATCH v1 2/2] bootlinux: Fold bootlinux-local into the bootlinux role cel 2025-05-19 9:32 ` Daniel Gomez 2025-05-19 13:15 ` Chuck Lever 2025-05-19 13:38 ` Daniel Gomez 2025-05-19 13:50 ` Chuck Lever 2025-05-19 9:13 ` [PATCH v1 1/2] bootlinux: Modernize install-deps/main.yml Daniel Gomez 2025-05-19 13:11 ` Chuck Lever 2025-05-19 13:51 ` Daniel Gomez
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox