From 0210360d9f69f6889e5799269ed2e5367b6a38f4 Mon Sep 17 00:00:00 2001 From: L3D Date: Sat, 29 Aug 2020 15:00:05 +0200 Subject: [PATCH] install python and python3 different --- tasks/packages.yml | 32 ++++++++++++++++++++++++++++++-- vars/main.yml | 23 +++++++++++++++++++---- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/tasks/packages.yml b/tasks/packages.yml index 9933bfa..6f65fdf 100644 --- a/tasks/packages.yml +++ b/tasks/packages.yml @@ -5,7 +5,24 @@ name: "{{ base__packages }}" state: "{{ base__package_state }}" -- name: install packages for all non-legacy x86 systems +- name: install python3 for all non-legacy systems + become: true + package: + name: "{{ base__python3_packages }}" + state: "{{ base__package_state }}" + when: | + ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 16.0 or + ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 7 or + ansible_distribution == 'Debian' and ansible_distribution_version | float >= 7 + +- name: install python for systems where python3 packages are renamed to python + become: true + package: + name: "{{ base__python_packages }}" + state: "{{ base__package_state }}" + when: ansible_os_family == 'Archlinux' + +- name: install packages for all non-legacy systems become: true package: name: "{{ base__modern_packages }}" @@ -25,7 +42,7 @@ ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 16.0 or ansible_distribution == 'Debian' and ansible_distribution_version | float >= 8 -- name: install packages for all reasonable non-legacy x86 systems +- name: install packages for all reasonable non-legacy systems become: true package: name: "{{ base__linux_packages }}" @@ -35,3 +52,14 @@ ansible_distribution == 'Fedora' and ansible_distribution_version | float >= 32 or ansible_distribution == 'Debian' and ansible_distribution_version | float >= 9 or ansible_os_family == 'Archlinux' + +- name: install os_family specific packages for all non-legacy systems + become: true + package: + name: "{{ ansible_os_family }}" + state: "{{ base__package_state }}" + when: | + ansible_distribution == 'Ubuntu' and ansible_distribution_version | float >= 18.0 or + ansible_os_family == 'RedHat' and ansible_distribution_version | float >= 7 or + ansible_distribution == 'Debian' and ansible_distribution_version | float >= 9 or + ansible_os_family == 'Archlinux' diff --git a/vars/main.yml b/vars/main.yml index 03665cf..827b8ac 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -21,7 +21,6 @@ base__modern_packages: - sysstat - smartmontools - # debian/ubuntu packages base__debian_packages: - debian-goodies @@ -36,12 +35,20 @@ base__debian_packages: - python3-apt - ethstatus +# modern python packages where python stands for python3 +base__python_packages: + - python-pip + - python + +# modern python packages +base__python3_packages: + - python3-pip + - python3 + # packages for reasonable linux servers (not RHEL/Centos) base__linux_packages: - links - ranger - - python3-pip - - python3 - htop - iotop - iftop @@ -51,7 +58,15 @@ base__linux_packages: - atop - asciinema - youtube-dl + +# os family_specific packages +Debian: - mpv -playbook_version_number: 9002 # should be over ninethousand +RedHat: [] + +Archlinux: + - mpv + +playbook_version_number: 9003 # should be over ninethousand playbook_version_path: 'base-packages_roles-ansible_github.version'