Skip to content

Commit

Permalink
devconfig: Replace import_tasks with include_tasks
Browse files Browse the repository at this point in the history
On a fresh Fedora 40 system, under buildbot, the devconfig role
fails:

statically imported: /var/lib/buildbot/worker/renoir1/nfsd-fixes-nfsd-pynfs/build/playbooks/roles/devconfig/tasks/install-deps/main.yml
statically imported: /var/lib/buildbot/worker/renoir1/nfsd-fixes-nfsd-pynfs/build/playbooks/roles/devconfig/tasks/install-deps/debian/main.yml
statically imported: /var/lib/buildbot/worker/renoir1/nfsd-fixes-nfsd-pynfs/build/playbooks/roles/devconfig/tasks/install-deps/suse/main.yml
redirecting (type: modules) ansible.builtin.zypper to community.general.zypper
ERROR! couldn't resolve module/action 'zypper'. This often indicates a misspelling, missing collection, or incorrect module path.

It shouldn't care about zypper, that's a Suse thing. Somewhere
the os_family sensing logic has gone hay-wire.

Handle this by using dynamic include_task instead of static
import_task, and restructure the os_family checking task in
install-deps/main.yml.

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
chucklever committed Jan 18, 2025
1 parent 94ae426 commit ec9a34e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
22 changes: 12 additions & 10 deletions playbooks/roles/devconfig/tasks/install-deps/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,23 @@
skip: true
tags: vars

# tasks to setup up repos, register system if needed and install
# preferred devtools packages.
- name: Distribution specific setup
tags: vars_simple
import_tasks: debian/main.yml
- name: Debian-specific setup
ansible.builtin.include_tasks: debian/main.yml
when:
- ansible_facts['os_family']|lower == 'debian'
- ansible_os_family == "Debian"
- devconfig_try_refresh_repos|bool or devconfig_try_install_kdevtools|bool or kdevops_cli_install|bool
- import_tasks: suse/main.yml
tags: vars_simple

- name: SuSE-specific setup
ansible.builtin.include_tasks: suse/main.yml
when:
- ansible_facts['os_family']|lower == 'suse'
- ansible_os_family == "Suse"
- devconfig_try_refresh_repos|bool or devconfig_try_install_kdevtools|bool or kdevops_cli_install|bool
- import_tasks: redhat/main.yml
tags: vars_simple

- name: Red Hat-specific setup
ansible.builtin.include_tasks: redhat/main.yml
when:
- ansible_facts['os_family']|lower == 'redhat'
- ansible_os_family == "RedHat"
- devconfig_try_refresh_repos|bool or devconfig_try_install_kdevtools|bool or kdevops_cli_install|bool
tags: vars_simple
8 changes: 4 additions & 4 deletions playbooks/roles/devconfig/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@

# Distro specific
- name: Install dependencies
import_tasks: install-deps/main.yml
ansible.builtin.include_tasks: install-deps/main.yml

- name: Configure custom repositories and install packages
import_tasks: config-custom-repos-and-packages/main.yml
ansible.builtin.include_tasks: config-custom-repos-and-packages/main.yml
when:
- ansible_facts['os_family']|lower == 'redhat'

Expand Down Expand Up @@ -447,7 +447,7 @@
tags: [ 'console' ]

- name: Update your boot GRUB file if necessary
import_tasks: update-grub/main.yml
ansible.builtin.include_tasks: update-grub/main.yml
when:
- grub2_config_file.stat.exists
- devconfig_enable_console|bool
Expand Down Expand Up @@ -637,7 +637,7 @@
tags: [ 'sysctl' ]

- name: Rev the kernel to the latest distribution kotd
import_tasks: kotd-rev-kernel/main.yml
ansible.builtin.include_tasks: kotd-rev-kernel/main.yml
when:
- devconfig_enable_kotd|bool
tags: [ 'kotd' ]

0 comments on commit ec9a34e

Please # to comment.