Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug report: dnf module and async tasks fail #11235

Closed
a-nldisr opened this issue Jun 11, 2015 · 5 comments
Closed

Bug report: dnf module and async tasks fail #11235

a-nldisr opened this issue Jun 11, 2015 · 5 comments
Labels
packaging Packaging category

Comments

@a-nldisr
Copy link

Issue Type:
Bug report

error:
fatal: [default] => lookup plugins (with_*) cannot be used with async tasks

Ansible version: 1.9.1
OS target machine: Fedora 22.

We replaced the yum in our playbooks with dnf and ran into above error.

Example:

- name: 'DNF - Install python bindings for SE Linux'   
  dnf: name={{ item }} state=present   
  with_items:   
    - libselinux-python   
    - libsemanage-python   
  async: 1000   
  poll: 0   
  register: dnf_se_sleeper   

- name: 'DNF - install python bindings for SE Linux and check on fire and forget task'   
  async_status: jid={{ dnf_se_sleeper.ansible_job_id }}    
  register: job_result   
  until: job_result.finished    
  retries: 30    

Just installed the machine with fedora 21, ran the exact same task with yum and this finishes correctly.

@bcoca
Copy link
Member

bcoca commented Jun 11, 2015

Possible Misunderstanding

Hi!

Thanks very much for your submission to Ansible. It sincerely means a lot to us.

We believe the ticket you have filed is being somewhat misunderstood, as one thing works a little differently than stated.

  • As the error message states, you cannot use async and with_ loops on the same task.

In the future, this might be a topic more well suited for the user list, which you can also post here if you'd like some more help with the above.

Thank you once again for this and your interest in Ansible!

@bcoca bcoca closed this as completed Jun 11, 2015
@abadger
Copy link
Contributor

abadger commented Jun 11, 2015

As a side note to this -- a few package related modules (yum and apt) have a special optimization pass inside of ansible so that with_* for package names gets turned into a comma separated string of packages that is passed to the module. This is probably why yum works and dnf doesn't. I'll add dnf to that optimization pass now.

As a workaround you can use a comma separated string here instead of with_items like either of these two examples:

- name: 'DNF - Install python bindings for SE Linux'   
  dnf: name="libselinux-python,libsemanage-python" state=present   
  async: 1000   
  poll: 0   
  register: dnf_se_sleeper  

[...]
vars:
  packagelist:
    - libselinux-python
    - libsemanage-python
[...]
- name: 'DNF - Install python bindings for SE Linux'   
  dnf: name="{{ packagelist | join(',') }}" state=present   
  async: 1000   
  poll: 0   
  register: dnf_se_sleeper  

@a-nldisr
Copy link
Author

Thanks abadger!

abadger added a commit that referenced this issue Jun 11, 2015
@abadger
Copy link
Contributor

abadger commented Jun 11, 2015

And added to the stable-1.9 branch as well as devel so that it will go out in the next release: 4a5a8ed

@a-nldisr
Copy link
Author

Thanks abadger! Great work!

@dagwieers dagwieers added the packaging Packaging category label Mar 3, 2019
@ansible ansible locked and limited conversation to collaborators Apr 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
packaging Packaging category
Projects
None yet
Development

No branches or pull requests

4 participants