From 3a48849a290653a1e8a7abd3ed6523d6114565c4 Mon Sep 17 00:00:00 2001 From: Timo Makinen Date: Sun, 18 Jun 2023 18:06:37 +0000 Subject: [PATCH] ansible_host: Fix running ansible on latest el9 Newest ansible version on el9 uses python 3.11 but netaddr package is not yet packaged for it. This patch will install python 3.9 netaddr package and copy library files from there. --- roles/ansible_host/tasks/main.yml | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/roles/ansible_host/tasks/main.yml b/roles/ansible_host/tasks/main.yml index a02ccdb..486e145 100644 --- a/roles/ansible_host/tasks/main.yml +++ b/roles/ansible_host/tasks/main.yml @@ -7,8 +7,28 @@ - ansible - ansible-collection-ansible-posix - ansible-collection-community-general - - python3-dns # required for lookup('dig', 'hostname') - - python3-netaddr # required by iptables role + - python3.11-dns # required for lookup('dig', 'hostname') + - python3-netaddr # required by iptables role + +- name: Create python3.11 lib directories + ansible.builtin.file: + path: "{{ item }}" + state: directory + mode: 0755 + owner: root + group: "{{ ansible_wheel }}" + with_items: + - /usr/local/lib/python3.11 + - /usr/local/lib/python3.11/site-packages + +- name: Kludge to add netaddr to python3.11 until package is released + ansible.builtin.copy: + dest: /usr/local/lib/python3.11/site-packages/netaddr + src: /usr/lib/python3.9/site-packages/netaddr + mode: preserve + owner: root + group: "{{ ansible_wheel }}" + remote_src: true - name: Create private directory and force permissions ansible.builtin.file: