Create directories if needed with ansible_pip_virtualenv_symlink
So, add more logic to ensure the parent directories for ansible_pip_virtualenv_symlink exists, before we symlink into it. Change-Id: I2c2a50f97610352a2e1e97fc92a7e9db2c851a25 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
32b5a5c3bf
commit
0f06193eae
@ -22,11 +22,27 @@
|
||||
virtualenv_python: "{{ ansible_pip_virtualenv_python|default(omit) }}"
|
||||
virtualenv: "{{ ansible_pip_virtualenv|default(omit) }}"
|
||||
|
||||
- name: Stat ansible_pip_virtualenv_symlink
|
||||
stat:
|
||||
path: "{{ ansible_pip_virtualenv_symlink | dirname }}"
|
||||
register: r
|
||||
no_log: true
|
||||
when: ansible_pip_virtualenv_symlink is defined
|
||||
|
||||
- name: Create ansible_pip_virtualenv_symlink directory
|
||||
become: true
|
||||
file:
|
||||
state: directory
|
||||
path: "{{ ansible_pip_virtualenv_symlink | dirname }}"
|
||||
when:
|
||||
- ansible_pip_virtualenv_symlink is defined
|
||||
- not r.stat.exists
|
||||
|
||||
- name: Symlink ansible virtualenv
|
||||
become: true
|
||||
file:
|
||||
src: "{{ ansible_pip_virtualenv }}"
|
||||
dest: "{{ ansible_pip_virtualenv_symlink }}"
|
||||
src: "{{ ansible_pip_virtualenv }}"
|
||||
state: link
|
||||
when:
|
||||
- ansible_pip_virtualenv is defined
|
||||
|
Loading…
Reference in New Issue
Block a user