From aed001382832841ec8cdc072728456c929ec84e8 Mon Sep 17 00:00:00 2001 From: victorely Date: Tue, 15 Oct 2024 14:23:39 +0200 Subject: [PATCH 1/6] feat: add compatibility for Ubuntu24 --- tasks/pkg.yml | 19 +++++++++++++++++-- vars/Debian.yml | 7 ++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/tasks/pkg.yml b/tasks/pkg.yml index 7ba9d8a..77b8e41 100755 --- a/tasks/pkg.yml +++ b/tasks/pkg.yml @@ -19,9 +19,15 @@ package: name: "{{ basic_common_pakages }}" -- name: Install extra packages +- name: Set specific packages based on Ubuntu version + set_fact: + specific_packages: >- + {{ ubuntu_22_packages if ansible_distribution == 'Ubuntu' and ansible_distribution_version == '22' else + ubuntu_24_packages if ansible_distribution == 'Ubuntu' and ansible_distribution_version == '24' else [] }} + +- name: Install common and specific packages package: - name: "{{ basic_extra_packages }}" + name: "{{ basic_common_pakages + specific_packages }}" state: present - name: Ensure Python2 lib are presents (CentOS 7) @@ -30,8 +36,17 @@ - python-setuptools when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' +- name: Install pip packages with extra args for Ubuntu 24 + pip: + executable: pip3 + name: "{{ basic_pip_packages }}" + state: present + extra_args: --break-system-packages + when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '24' + - name: Install pip packages pip: executable: pip3 name: "{{ basic_pip_packages }}" state: present + when: not (ansible_distribution == 'Ubuntu' and ansible_distribution_version == '24') diff --git a/vars/Debian.yml b/vars/Debian.yml index 123f115..2bbdd29 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -53,6 +53,11 @@ basic_common_pakages: - man-db - lsof - pv - - netcat - iperf3 - smartmontools + +ubuntu_22_packages: + - netcat + +ubuntu_24_packages: + - netcat-traditional From 9b348638a4666fd6959a09b92874806f99ae2b4f Mon Sep 17 00:00:00 2001 From: victorely Date: Tue, 15 Oct 2024 14:25:03 +0200 Subject: [PATCH 2/6] fix: name of basic_common_packages --- tasks/pkg.yml | 2 +- vars/Debian.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/pkg.yml b/tasks/pkg.yml index 77b8e41..b9cd9d0 100755 --- a/tasks/pkg.yml +++ b/tasks/pkg.yml @@ -27,7 +27,7 @@ - name: Install common and specific packages package: - name: "{{ basic_common_pakages + specific_packages }}" + name: "{{ basic_common_packages + specific_packages }}" state: present - name: Ensure Python2 lib are presents (CentOS 7) diff --git a/vars/Debian.yml b/vars/Debian.yml index 2bbdd29..bd55600 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -26,7 +26,7 @@ basic_mandatory_packages: - locales # Common package that should be installed -basic_common_pakages: +basic_common_packages: - logrotate - anacron - vim From 20e854b52898f41fcd6f4f183a3a9722c60a81e3 Mon Sep 17 00:00:00 2001 From: victorely Date: Tue, 15 Oct 2024 14:27:23 +0200 Subject: [PATCH 3/6] fix: use pipx --- tasks/pkg.yml | 3 +-- vars/Debian.yml | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/pkg.yml b/tasks/pkg.yml index b9cd9d0..adf104b 100755 --- a/tasks/pkg.yml +++ b/tasks/pkg.yml @@ -38,10 +38,9 @@ - name: Install pip packages with extra args for Ubuntu 24 pip: - executable: pip3 + executable: pipx name: "{{ basic_pip_packages }}" state: present - extra_args: --break-system-packages when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '24' - name: Install pip packages diff --git a/vars/Debian.yml b/vars/Debian.yml index bd55600..af71730 100644 --- a/vars/Debian.yml +++ b/vars/Debian.yml @@ -61,3 +61,4 @@ ubuntu_22_packages: ubuntu_24_packages: - netcat-traditional + - pipx From 30e4379a216de41fe91f66a2a2993863a756dc9e Mon Sep 17 00:00:00 2001 From: victorely Date: Tue, 15 Oct 2024 15:01:22 +0200 Subject: [PATCH 4/6] fix: basic_extra_packages --- tasks/pkg.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/pkg.yml b/tasks/pkg.yml index adf104b..e4358b8 100755 --- a/tasks/pkg.yml +++ b/tasks/pkg.yml @@ -17,7 +17,7 @@ - name: Install common packages package: - name: "{{ basic_common_pakages }}" + name: "{{ basic_common_packages }}" - name: Set specific packages based on Ubuntu version set_fact: @@ -27,7 +27,7 @@ - name: Install common and specific packages package: - name: "{{ basic_common_packages + specific_packages }}" + name: "{{ basic_extra_packages + specific_packages }}" state: present - name: Ensure Python2 lib are presents (CentOS 7) From 0c179e221b31e7316117144fc76972016cea9a07 Mon Sep 17 00:00:00 2001 From: victorely Date: Tue, 15 Oct 2024 15:05:44 +0200 Subject: [PATCH 5/6] feat: change when (add version_compare) --- tasks/pkg.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tasks/pkg.yml b/tasks/pkg.yml index e4358b8..01aca61 100755 --- a/tasks/pkg.yml +++ b/tasks/pkg.yml @@ -22,8 +22,8 @@ - name: Set specific packages based on Ubuntu version set_fact: specific_packages: >- - {{ ubuntu_22_packages if ansible_distribution == 'Ubuntu' and ansible_distribution_version == '22' else - ubuntu_24_packages if ansible_distribution == 'Ubuntu' and ansible_distribution_version == '24' else [] }} + {{ ubuntu_22_packages if ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('22', '<=') else + ubuntu_24_packages if ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('24', '>=') else [] }} - name: Install common and specific packages package: @@ -36,16 +36,17 @@ - python-setuptools when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7' -- name: Install pip packages with extra args for Ubuntu 24 +- name: Install pip packages with extra args for Ubuntu 24 or more pip: executable: pipx name: "{{ basic_pip_packages }}" state: present - when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '24' + extra_args: --break-system-packages + when: ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('24', '>=') - name: Install pip packages pip: executable: pip3 name: "{{ basic_pip_packages }}" state: present - when: not (ansible_distribution == 'Ubuntu' and ansible_distribution_version == '24') + when: ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('22', '<=') From 29d3ee560b037edbfe95edb6aaa9582db0140481 Mon Sep 17 00:00:00 2001 From: victorely Date: Tue, 15 Oct 2024 15:36:00 +0200 Subject: [PATCH 6/6] feat: change name task --- tasks/pkg.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/pkg.yml b/tasks/pkg.yml index 01aca61..d973b26 100755 --- a/tasks/pkg.yml +++ b/tasks/pkg.yml @@ -25,7 +25,7 @@ {{ ubuntu_22_packages if ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('22', '<=') else ubuntu_24_packages if ansible_distribution == 'Ubuntu' and ansible_distribution_version is version_compare('24', '>=') else [] }} -- name: Install common and specific packages +- name: Install extra and specific packages package: name: "{{ basic_extra_packages + specific_packages }}" state: present