From 1dd86348a99ff59c2f99af0988dc78ef6275274e Mon Sep 17 00:00:00 2001 From: Bertrand Lanson Date: Tue, 22 Aug 2023 23:46:01 +0200 Subject: [PATCH] non functional for now --- defaults/main.yml | 5 +++++ meta/main.yml | 3 ++- tasks/main.yml | 11 +++++++++++ tasks/prerequisites.yml | 7 +++++++ vars/main.yml | 7 +++++++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 tasks/prerequisites.yml diff --git a/defaults/main.yml b/defaults/main.yml index c80e86a..7dc819b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,2 +1,7 @@ --- # defaults file for manage_pipx_packages +manage_pipx_packages_install_prereqs: true +manage_pipx_packages_list: + - name: pip + version_constraint: latest + state: present diff --git a/meta/main.yml b/meta/main.yml index 45f2772..16ffc5f 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -4,7 +4,7 @@ galaxy_info: namespace: 'ednxzu' role_name: 'manage_pipx_packages' author: 'Bertrand Lanson' - description: '' + description: 'Package management for python using pipx on debian-based distros.' license: 'license (BSD, MIT)' min_ansible_version: '2.10' platforms: @@ -15,6 +15,7 @@ galaxy_info: - name: Debian versions: - bullseye + - bookworm galaxy_tags: - 'ubuntu' - 'debian' diff --git a/tasks/main.yml b/tasks/main.yml index ecb7561..cd41bac 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,2 +1,13 @@ --- # task/main file for manage_pipx_packages +- name: "Import prerequisites.yml" + ansible.builtin.include_tasks: prerequisites.yml + when: manage_pip_packages_install_prereqs + +- name: "Install/remove required pip packages" + community.general.pipx: + name: "{{ item.name }}{% if item.version_constraint not in [None, '', 'latest'] %}{{ item.version_constraint }}{% endif %}" + state: "{{ item.state }}" + loop: "{{ manage_pip_packages_list }}" + when: manage_pip_packages_list is defined + and manage_pip_packages_list not in [None, ''] diff --git a/tasks/prerequisites.yml b/tasks/prerequisites.yml new file mode 100644 index 0000000..55a3318 --- /dev/null +++ b/tasks/prerequisites.yml @@ -0,0 +1,7 @@ +--- +# task/prerequisites file for manage_pipx_packages +- name: "Install python3 and pipx" + ansible.builtin.include_role: + name: ednxzu.manage_apt_packages + vars: + manage_apt_packages_list: "{{ manage_pipx_packages_required_packages }}" diff --git a/vars/main.yml b/vars/main.yml index 680926e..2db69be 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -1,2 +1,9 @@ --- # vars file for manage_pipx_packages +manage_pipx_packages_required_packages: + - name: python3 + version: latest + state: present + - name: pipx + version: latest + state: present