diff mbox series

[v1,5/9] devconfig: Replace import_tasks with include_tasks

Message ID 20250114200348.1706018-6-cel@kernel.org (mailing list archive)
State New
Headers show
Series Random short subjects | expand

Commit Message

Chuck Lever Jan. 14, 2025, 8:03 p.m. UTC
From: Chuck Lever <chuck.lever@oracle.com>

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.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 .../devconfig/tasks/install-deps/main.yml     | 22 ++++++++++---------
 playbooks/roles/devconfig/tasks/main.yml      |  8 +++----
 2 files changed, 16 insertions(+), 14 deletions(-)

Comments

Daniel Gomez Jan. 28, 2025, 1:03 p.m. UTC | #1
Hi Chuck,

On Tue, Jan 14, 2025 at 03:03:44PM -0500, cel@kernel.org wrote:
> From: Chuck Lever <chuck.lever@oracle.com>
> 
> 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.
> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
>  .../devconfig/tasks/install-deps/main.yml     | 22 ++++++++++---------
>  playbooks/roles/devconfig/tasks/main.yml      |  8 +++----
>  2 files changed, 16 insertions(+), 14 deletions(-)
> 
> diff --git a/playbooks/roles/devconfig/tasks/install-deps/main.yml b/playbooks/roles/devconfig/tasks/install-deps/main.yml
> index 7034ac2e8eee..bd5fa6d4becd 100644
> --- a/playbooks/roles/devconfig/tasks/install-deps/main.yml
> +++ b/playbooks/roles/devconfig/tasks/install-deps/main.yml
> @@ -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

Replacing import_tasks in the ansible include_tasks module is making the
kdevops CI fail as reported here [1].

https://lore.kernel.org/kdevops/20250128112453.rawxqvpffxwupvco@AALNPWDAGOMEZ1.aal.scsc.local/T/#t

The CI failure indicates the tasks inside debian yml are not actually
executed before the rest of the playbook.

I have other debian/non-debian workflows where the conditional does not
conflict with the imported tasks when using ansible_facts['os_family']|
lower == 'debian'. And I think this is what we need here. Any idea
what the error might be on your end when using import_tasks instead
of include_tasks?


Daniel

>    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
> diff --git a/playbooks/roles/devconfig/tasks/main.yml b/playbooks/roles/devconfig/tasks/main.yml
> index db96e9489c15..51b890375215 100644
> --- a/playbooks/roles/devconfig/tasks/main.yml
> +++ b/playbooks/roles/devconfig/tasks/main.yml
> @@ -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'
>  
> @@ -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
> @@ -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' ]
> -- 
> 2.47.1
>
Chuck Lever Jan. 28, 2025, 2:20 p.m. UTC | #2
On 1/28/25 8:03 AM, Daniel Gomez wrote:
> Hi Chuck,
> 
> On Tue, Jan 14, 2025 at 03:03:44PM -0500, cel@kernel.org wrote:
>> From: Chuck Lever <chuck.lever@oracle.com>
>>
>> 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.
>>
>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>> ---
>>   .../devconfig/tasks/install-deps/main.yml     | 22 ++++++++++---------
>>   playbooks/roles/devconfig/tasks/main.yml      |  8 +++----
>>   2 files changed, 16 insertions(+), 14 deletions(-)
>>
>> diff --git a/playbooks/roles/devconfig/tasks/install-deps/main.yml b/playbooks/roles/devconfig/tasks/install-deps/main.yml
>> index 7034ac2e8eee..bd5fa6d4becd 100644
>> --- a/playbooks/roles/devconfig/tasks/install-deps/main.yml
>> +++ b/playbooks/roles/devconfig/tasks/install-deps/main.yml
>> @@ -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
> 
> Replacing import_tasks in the ansible include_tasks module is making the
> kdevops CI fail as reported here [1].
> 
> https://lore.kernel.org/kdevops/20250128112453.rawxqvpffxwupvco@AALNPWDAGOMEZ1.aal.scsc.local/T/#t
> 
> The CI failure indicates the tasks inside debian yml are not actually
> executed before the rest of the playbook.

I don't understand. The playbook steps are executed serially by all
hosts. The steps in the included .yml file should happen before any
subsequent steps in the devconfig.yml file.


> I have other debian/non-debian workflows where the conditional does not
> conflict with the imported tasks when using ansible_facts['os_family']|
> lower == 'debian'.

So in previous cases where this came up, Debian was working as
expected, but Red Hat (Fedora) was not. This happened in every
one of these cases.

Those fixes are far enough in the past that they would appear only
in the "historical" kdevops repo.


> And I think this is what we need here. Any idea
> what the error might be on your end when using import_tasks instead
> of include_tasks?

I can have a look. I don't understand the bug report above well
enough to answer your question immediately.

"import_tasks" has some subtle behaviors -- it seems to be pretty
brittle in my experience.


>>     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
>> diff --git a/playbooks/roles/devconfig/tasks/main.yml b/playbooks/roles/devconfig/tasks/main.yml
>> index db96e9489c15..51b890375215 100644
>> --- a/playbooks/roles/devconfig/tasks/main.yml
>> +++ b/playbooks/roles/devconfig/tasks/main.yml
>> @@ -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'
>>   
>> @@ -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
>> @@ -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' ]
>> -- 
>> 2.47.1
>>
Daniel Gomez Jan. 28, 2025, 2:40 p.m. UTC | #3
On Tue, Jan 28, 2025 at 09:20:35AM -0500, Chuck Lever wrote:
> On 1/28/25 8:03 AM, Daniel Gomez wrote:
> > Hi Chuck,
> > 
> > On Tue, Jan 14, 2025 at 03:03:44PM -0500, cel@kernel.org wrote:
> > > From: Chuck Lever <chuck.lever@oracle.com>
> > > 
> > > 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.
> > > 
> > > Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> > > ---
> > >   .../devconfig/tasks/install-deps/main.yml     | 22 ++++++++++---------
> > >   playbooks/roles/devconfig/tasks/main.yml      |  8 +++----
> > >   2 files changed, 16 insertions(+), 14 deletions(-)
> > > 
> > > diff --git a/playbooks/roles/devconfig/tasks/install-deps/main.yml b/playbooks/roles/devconfig/tasks/install-deps/main.yml
> > > index 7034ac2e8eee..bd5fa6d4becd 100644
> > > --- a/playbooks/roles/devconfig/tasks/install-deps/main.yml
> > > +++ b/playbooks/roles/devconfig/tasks/install-deps/main.yml
> > > @@ -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
> > 
> > Replacing import_tasks in the ansible include_tasks module is making the
> > kdevops CI fail as reported here [1].
> > 
> > https://lore.kernel.org/kdevops/20250128112453.rawxqvpffxwupvco@AALNPWDAGOMEZ1.aal.scsc.local/T/#t
> > 
> > The CI failure indicates the tasks inside debian yml are not actually
> > executed before the rest of the playbook.
> 
> I don't understand. The playbook steps are executed serially by all
> hosts. The steps in the included .yml file should happen before any
> subsequent steps in the devconfig.yml file.

I don't see the install-deps being executed before the playbook checks
if the journal client service is up un running.

> 
> 
> > I have other debian/non-debian workflows where the conditional does not
> > conflict with the imported tasks when using ansible_facts['os_family']|
> > lower == 'debian'.
> 
> So in previous cases where this came up, Debian was working as
> expected, but Red Hat (Fedora) was not. This happened in every
> one of these cases.
> 
> Those fixes are far enough in the past that they would appear only
> in the "historical" kdevops repo.
> 
> 
> > And I think this is what we need here. Any idea
> > what the error might be on your end when using import_tasks instead
> > of include_tasks?
> 
> I can have a look. I don't understand the bug report above well
> enough to answer your question immediately.
> 
> "import_tasks" has some subtle behaviors -- it seems to be pretty
> brittle in my experience.

Thanks for checking it!

FYI, I replicated the error in the CI server using the CI workflow. You
will see the install-deps are not executed before we reach the point in
the playbook where the journal client service is required.

> 
> 
> > >     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
> > > diff --git a/playbooks/roles/devconfig/tasks/main.yml b/playbooks/roles/devconfig/tasks/main.yml
> > > index db96e9489c15..51b890375215 100644
> > > --- a/playbooks/roles/devconfig/tasks/main.yml
> > > +++ b/playbooks/roles/devconfig/tasks/main.yml
> > > @@ -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'
> > > @@ -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
> > > @@ -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' ]
> > > -- 
> > > 2.47.1
> > > 
> 
> 
> -- 
> Chuck Lever
Chuck Lever Jan. 28, 2025, 2:43 p.m. UTC | #4
On 1/28/25 9:40 AM, Daniel Gomez wrote:
> On Tue, Jan 28, 2025 at 09:20:35AM -0500, Chuck Lever wrote:
>> On 1/28/25 8:03 AM, Daniel Gomez wrote:
>>> Hi Chuck,
>>>
>>> On Tue, Jan 14, 2025 at 03:03:44PM -0500, cel@kernel.org wrote:
>>>> From: Chuck Lever <chuck.lever@oracle.com>
>>>>
>>>> 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.
>>>>
>>>> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
>>>> ---
>>>>    .../devconfig/tasks/install-deps/main.yml     | 22 ++++++++++---------
>>>>    playbooks/roles/devconfig/tasks/main.yml      |  8 +++----
>>>>    2 files changed, 16 insertions(+), 14 deletions(-)
>>>>
>>>> diff --git a/playbooks/roles/devconfig/tasks/install-deps/main.yml b/playbooks/roles/devconfig/tasks/install-deps/main.yml
>>>> index 7034ac2e8eee..bd5fa6d4becd 100644
>>>> --- a/playbooks/roles/devconfig/tasks/install-deps/main.yml
>>>> +++ b/playbooks/roles/devconfig/tasks/install-deps/main.yml
>>>> @@ -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
>>>
>>> Replacing import_tasks in the ansible include_tasks module is making the
>>> kdevops CI fail as reported here [1].
>>>
>>> https://lore.kernel.org/kdevops/20250128112453.rawxqvpffxwupvco@AALNPWDAGOMEZ1.aal.scsc.local/T/#t
>>>
>>> The CI failure indicates the tasks inside debian yml are not actually
>>> executed before the rest of the playbook.
>>
>> I don't understand. The playbook steps are executed serially by all
>> hosts. The steps in the included .yml file should happen before any
>> subsequent steps in the devconfig.yml file.
> 
> I don't see the install-deps being executed before the playbook checks
> if the journal client service is up un running.

Could this be a "tags" problem?


>>> I have other debian/non-debian workflows where the conditional does not
>>> conflict with the imported tasks when using ansible_facts['os_family']|
>>> lower == 'debian'.
>>
>> So in previous cases where this came up, Debian was working as
>> expected, but Red Hat (Fedora) was not. This happened in every
>> one of these cases.
>>
>> Those fixes are far enough in the past that they would appear only
>> in the "historical" kdevops repo.
>>
>>
>>> And I think this is what we need here. Any idea
>>> what the error might be on your end when using import_tasks instead
>>> of include_tasks?
>>
>> I can have a look. I don't understand the bug report above well
>> enough to answer your question immediately.
>>
>> "import_tasks" has some subtle behaviors -- it seems to be pretty
>> brittle in my experience.
> 
> Thanks for checking it!
> 
> FYI, I replicated the error in the CI server using the CI workflow. You
> will see the install-deps are not executed before we reach the point in
> the playbook where the journal client service is required.
> 
>>
>>
>>>>      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
>>>> diff --git a/playbooks/roles/devconfig/tasks/main.yml b/playbooks/roles/devconfig/tasks/main.yml
>>>> index db96e9489c15..51b890375215 100644
>>>> --- a/playbooks/roles/devconfig/tasks/main.yml
>>>> +++ b/playbooks/roles/devconfig/tasks/main.yml
>>>> @@ -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'
>>>> @@ -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
>>>> @@ -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' ]
>>>> -- 
>>>> 2.47.1
>>>>
>>
>>
>> -- 
>> Chuck Lever
diff mbox series

Patch

diff --git a/playbooks/roles/devconfig/tasks/install-deps/main.yml b/playbooks/roles/devconfig/tasks/install-deps/main.yml
index 7034ac2e8eee..bd5fa6d4becd 100644
--- a/playbooks/roles/devconfig/tasks/install-deps/main.yml
+++ b/playbooks/roles/devconfig/tasks/install-deps/main.yml
@@ -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
diff --git a/playbooks/roles/devconfig/tasks/main.yml b/playbooks/roles/devconfig/tasks/main.yml
index db96e9489c15..51b890375215 100644
--- a/playbooks/roles/devconfig/tasks/main.yml
+++ b/playbooks/roles/devconfig/tasks/main.yml
@@ -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'
 
@@ -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
@@ -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' ]