diff --git a/IM/ansible_utils/ansible_executor_v2.py b/IM/ansible_utils/ansible_executor_v2.py index 9d22fbc1..c5241d65 100644 --- a/IM/ansible_utils/ansible_executor_v2.py +++ b/IM/ansible_utils/ansible_executor_v2.py @@ -378,6 +378,13 @@ def run(self): # Create a specific dir for the local temp C.DEFAULT_LOCAL_TMP = tempfile.mkdtemp() + try: + # Initialize the plugin loader for ansible 2.15.0 or higher + from ansible.plugins.loader import init_plugin_loader + init_plugin_loader([]) + except ImportError: + pass + result = 0 try: pb = Playbook.load(self._playbook, variable_manager=self._variable_manager, loader=self._loader) diff --git a/contextualization/conf-ansible.yml b/contextualization/conf-ansible.yml index 49381539..5ea7096c 100644 --- a/contextualization/conf-ansible.yml +++ b/contextualization/conf-ansible.yml @@ -169,10 +169,10 @@ - name: Set Ansible newer version for python 3.12 set_fact: - ANSIBLE_VERSION: 6.7.0 + ANSIBLE_VERSION: 8.7.0 when: - ansible_python_version is version('3.12', '>=') - - ANSIBLE_VERSION is version('6.7.0', '<') + - ANSIBLE_VERSION is version('8.7.0', '<') - name: Install ansible {{ ANSIBLE_VERSION }} with Pip pip: