question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ansible 2.10.5 RHEL 8 with package module

See original GitHub issue

When using the package module with the latest RC (as well as latest commit on master branch) of Mitogen for Ansible 2.10.5, I am receiving an exception;

fatal: [EL8]: FAILED! => {
    ansible_facts":
        "discovered_interpreter_python": "/usr/libexec/platform-python"
    "changed": false
    "module_stderr":
        Traceback (most recent call last):
          File "master:/Users/dsgnr/.virtualenvs/ansible/lib/python3.7/site-packages/ansible_mitogen/runner.py", line 975, in _run
            self._run_code(code, mod)
          File "master:/Users/dsgnr/.virtualenvs/ansible/lib/python3.7/site-packages/ansible_mitogen/runner.py", line 939, in _run_code
            exec(code, vars(mod))
          File "master:/Users/dsgnr/.virtualenvs/py3/lib/python3.7/site-packages/ansible/modules/dnf.py", line 1330, in <module>
          File "master:/Users/dsgnr/.virtualenvs/py3/lib/python3.7/site-packages/ansible/modules/dnf.py", line 1319, in main
          File "master:/Users/dsgnr/.virtualenvs/py3/lib/python3.7/site-packages/ansible/modules/dnf.py", line 1288, in run
          File "master:/Users/dsgnr/.virtualenvs/py3/lib/python3.7/site-packages/ansible/modules/dnf.py", line 620, in _base
          File "/usr/lib/python3.6/site-packages/dnf/base.py", line 300, in init_plugins
            self._plugins._load(self.conf, disabled_glob, enable_plugins)
          File "/usr/lib/python3.6/site-packages/dnf/plugin.py", line 131, in _load
            raise RuntimeError("load_plugins() called twice")
        RuntimeError: load_plugins() called twice
    "module_stdout": ""
    "msg":
        MODULE FAILURE
        See stdout/stderr for the exact error
    "rc": 1
}
+- name: Install package
+  package:
+    name: "{{ package }}"
+    state: present

However, using the individual modules works fine;

+- name: Install package for Ubuntu
+  apt:
+    name: "{{ package }}"
+    state: present
+  when: ansible_os_family == "Ubuntu"
+
+- name: Install package for RHEL up to version 7
+  yum:
+    name: "{{ package }}"
+    state: present
+  when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int <= 7
+
+- name: Install package for RHEL 8
+  dnf:
+    name: "{{ package }}"
+    state: present
+  when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int == 8
  • Which version of Ansible are you running? Ansible 2.10.5

  • Is your version of Ansible patched in any way?

  • No

  • Are you running with any custom modules, or module_utils loaded? No

  • Have you tried the latest master version from Git? Running v0.3.0-rc.0

  • Do you have some idea of what the underlying problem may be?

  • Mention your host and target OS and versions Red Hat Enterprise Linux release 8.3 (Ootpa)

  • Mention your host and target Python versions

# /usr/libexec/platform-python
Python 3.6.8 (default, Aug 18 2020, 08:33:21)
[GCC 8.3.1 20191121 (Red Hat 8.3.1-5)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

EDIT (AW): Formatted error and traceback

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:3
  • Comments:18 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
annttucommented, Mar 26, 2021

Adding ansible.legacy.dnf to ALWAYS_FORK_MODULES list in ansible_mitogen/planner.py seems to fix this issue with yum.

+++ ./ansible_mitogen/planner.py	2021-03-26 14:18:56.000000000 +0200
@@ -321,6 +321,7 @@
     ALWAYS_FORK_MODULES = frozenset([
         'dnf',  # issue #280; py-dnf/hawkey need therapy
         'firewalld',  # issue #570: ansible module_utils caches dbus conn
+        'ansible.legacy.dnf',  # issue #776
     ])

     def should_fork(self):
3reactions
bradh352commented, Jul 15, 2021

If you want to easily install the PR #845 that contains this fix without manually patching, you can run something like: pip install git+https://github.com/mitogen-hq/mitogen.git@refs/pull/845/merge

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installing Ansible
Selecting an Ansible package and version to install. Installing and upgrading Ansible. Locating Python. Ensuring pip is available. Installing Ansible.
Read more >
Quick start guide to Ansible for Linux sysadmins
To install Ansible on the RHEL 8 control node after registering with the Satellite server, run the command yum install ansible . This...
Read more >
How to install Ansible in RedHat Enterprise Linux (RHEL) 8 ...
How to install Ansible in Red Hat Enterprise Linux version 8. ... ansible python module location = /usr/lib/python3.9/site-packages/ansible ...
Read more >
How do I install a software package from the Extras Library ...
How do I install a software package (known as a topic) from the ... =9.6.8 ] 6 postgresql10 available [ =10 ] 8...
Read more >
Installing and Upgrading Ansible with *pip | by Alex Duncan
Follow these instructions to install the Ansible community package on a variety of operating systems. Installing Ansible on RHEL, CentOS, or Fedora. On...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found