generated from ansible/desktop
only install pip if it doesn't exist
This commit is contained in:
parent
f37e34ed67
commit
318c41629e
|
@ -55,6 +55,11 @@
|
|||
line: "{{ common_deploy_user_name }} ALL=(ALL) NOPASSWD: ALL"
|
||||
state: "present"
|
||||
|
||||
- name: "Check if pip is installed"
|
||||
ansible.builtin.stat:
|
||||
path: "/usr/local/bin/pip3"
|
||||
register: pip_state
|
||||
|
||||
- name: "Download the newest Pip"
|
||||
get_url:
|
||||
url: "https://bootstrap.pypa.io/get-pip.py"
|
||||
|
@ -63,15 +68,25 @@
|
|||
when:
|
||||
- ansible_facts['distribution_major_version'] | int >= 20
|
||||
- ansible_facts['distribution'] == "Ubuntu"
|
||||
- not pip_state.stat.exists
|
||||
|
||||
- name: "Download Pip for Python 3.5"
|
||||
get_url:
|
||||
url: "https://bootstrap.pypa.io/pip/3.5/get-pip.py"
|
||||
dest: "/tmp/get-pip.py"
|
||||
mode: "0644"
|
||||
when: (not ansible_facts['distribution_major_version'] | int >= 20
|
||||
or not ansible_facts['distribution'] == "Ubuntu")
|
||||
when:
|
||||
- (not ansible_facts['distribution_major_version'] | int >= 20
|
||||
or not ansible_facts['distribution'] == "Ubuntu")
|
||||
- not pip_state.stat.exists
|
||||
|
||||
- name: "Install pip"
|
||||
command:
|
||||
cmd: "python3 /tmp/get-pip.py"
|
||||
when: not pip_state.stat.exists
|
||||
|
||||
- name: "Upgrade pip"
|
||||
ansible.builtin.pip:
|
||||
name: pip
|
||||
state: latest
|
||||
when: pip_state.stat.exists
|
||||
|
|
Reference in New Issue