File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 3
3
os_openstackclient_venv :
4
4
# Whether to install package dependencies.
5
5
os_openstackclient_install_package_dependencies : true
6
+ # Value to use for the pip module's `virtualenv_command` argument when creating the virtualenv
7
+ os_openstackclient_virtualenv_command : " {{ os_openstackclient_virtualenv_python ~ ' -m venv' if os_openstackclient_venv else omit }}"
8
+ # Python interpreter to use in virtualenv command; `os_virtualenv_python` can be used to set this collection wide.
9
+ os_openstackclient_virtualenv_python : " {{ os_virtualenv_python | default('python3.' ~ ansible_facts.python.version.minor) }}"
6
10
7
11
# State of the openstackclient package.
8
12
os_openstackclient_state : present
Original file line number Diff line number Diff line change 14
14
become : " {{ ansible_facts.system != 'Darwin' }}"
15
15
when : os_openstackclient_install_package_dependencies | bool
16
16
17
+ - name : Remove virtualenv if python version is stale
18
+ ansible.builtin.file :
19
+ path : " {{ os_openstackclient_venv }}"
20
+ state : absent
21
+ when :
22
+ - os_openstackclient_venv is not none
23
+ - (os_openstackclient_venv ~ '/bin/python') | realpath != os_openstackclient_virtualenv_python | realpath
24
+
17
25
- name : Ensure the virtualenv directory exists
18
26
when : os_openstackclient_venv is not none
19
27
block :
40
48
name : " {{ item.name }}"
41
49
state : latest
42
50
virtualenv : " {{ os_openstackclient_venv or omit }}"
43
- virtualenv_command : " {{ 'python3.' ~ ansible_facts.python.version.minor ~ ' -m venv' if os_openstackclient_venv else omit }}"
51
+ virtualenv_command : " {{ os_openstackclient_virtualenv_command }}"
44
52
with_items :
45
53
- { name: pip }
46
54
- { name: setuptools }
Original file line number Diff line number Diff line change 2
2
# Path to a directory in which to create a virtualenv.
3
3
os_openstacksdk_venv :
4
4
# Value to use for the pip module's `virtualenv_command` argument when creating the virtualenv
5
- os_openstacksdk_virtualenv_command : " {{ 'python3.' ~ ansible_facts.python.version.minor ~ ' -m venv' if os_openstacksdk_venv else omit }}"
5
+ os_openstacksdk_virtualenv_command : " {{ os_openstacksdk_virtualenv_python ~ ' -m venv' if os_openstacksdk_venv else omit }}"
6
+ # Python interpreter to use in virtualenv command; `os_virtualenv_python` can be used to set this collection wide.
7
+ os_openstacksdk_virtualenv_python : " {{ os_virtualenv_python | default('python3.' ~ ansible_facts.python.version.minor) }}"
6
8
7
9
# Whether to install package dependencies.
8
10
os_openstacksdk_install_package_dependencies : true
Original file line number Diff line number Diff line change 20
20
become : " {{ ansible_facts.system != 'Darwin' }}"
21
21
when : os_openstacksdk_install_package_dependencies | bool
22
22
23
+ - name : Remove virtualenv if python version is stale
24
+ ansible.builtin.file :
25
+ path : " {{ os_openstacksdk_venv }}"
26
+ state : absent
27
+ when :
28
+ - os_openstacksdk_venv is not none
29
+ - (os_openstacksdk_venv ~ '/bin/python') | realpath != os_openstacksdk_virtualenv_python | realpath
30
+
23
31
- name : Ensure the virtualenv directory exists
24
32
when : os_openstacksdk_venv is not none
25
33
block :
You can’t perform that action at this time.
0 commit comments