From b70d0a734e73dd4a7646e0575ef15c4ed45af372 Mon Sep 17 00:00:00 2001 From: Laba Subagia Date: Fri, 19 Jul 2024 23:10:37 +0800 Subject: [PATCH] chore: pip --- ansible/tasks/dev/python/pip-packages.yml | 9 +++++++-- ansible/tasks/hello.yml | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ansible/tasks/dev/python/pip-packages.yml b/ansible/tasks/dev/python/pip-packages.yml index b2bbca9..9e4bfa1 100644 --- a/ansible/tasks/dev/python/pip-packages.yml +++ b/ansible/tasks/dev/python/pip-packages.yml @@ -15,6 +15,11 @@ path: "{{ pip_executable }}" register: pip + - name: Setup pip > set facts + ansible.builtin.set_fact: + pip_extra_args: + - "{{ '--break-system-packages' if ansible_distribution == 'Debian' else '' }}" + - name: Setup pip > executable exists when: pip.stat.exists block: @@ -25,7 +30,7 @@ ansible.builtin.pip: name: "{{ pip_pkgs }}" # break_system_packages: true # only ansible >=v2.17 - extra_args: --break-system-packages + extra_args: "{{ pip_extra_args | join(' ') }}" state: present executable: "{{ pip_executable }}" @@ -36,6 +41,6 @@ ansible.builtin.pip: name: "{{ pip_pkgs }}" # break_system_packages: true # only ansible >=v2.17 - extra_args: --break-system-packages + extra_args: "{{ pip_extra_args | join(' ') }}" state: absent executable: "{{ pip_executable }}" diff --git a/ansible/tasks/hello.yml b/ansible/tasks/hello.yml index 576604f..e252ced 100644 --- a/ansible/tasks/hello.yml +++ b/ansible/tasks/hello.yml @@ -7,3 +7,4 @@ msg: host: "{{ ansible_host }}" connection: "{{ ansible_connection }}" + distribution: "{{ ansible_distribution }}"