Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix conditionals for python requirements #822

Merged
merged 3 commits into from
Apr 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions roles/splunk_common/tasks/install_python_requirements.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@
name: pip
extra_args: --upgrade
executable: pip3
when: requests_unixsocket_check is failed
when: requests_unixsocket_check.stdout is undefined

- name: Check if pip3 unixsocket exits
command: "pip3 list | grep 'requests-unixsocket'"
register: requests_unixsocket_check_py3
when: requests_unixsocket_check is failed
when: requests_unixsocket_check.stdout is undefined
ignore_errors: true

- name: Install missing requests_unixsocket
ansible.builtin.pip:
name: "requests_unixsocket"
when: requests_unixsocket_check is succeeded and (requests_unixsocket_check.stdout | length == 0 or requests_unixsocket_check.stdout.find("requests-unixsocket") == -1)
when:
- requests_unixsocket_check.stdout is defined
- requests_unixsocket_check.stdout | length == 0 or requests_unixsocket_check.stdout.find("requests-unixsocket") == -1

- name: Install missing requests_unixsocket PY3
ansible.builtin.pip:
name: "requests_unixsocket"
when: requests_unixsocket_check_py3 is succeeded and (requests_unixsocket_check_py3.stdout | length == 0 or requests_unixsocket_check_py3.stdout.find("requests-unixsocket") == -1)
when:
- requests_unixsocket_check_py3.stdout is defined
- requests_unixsocket_check_py3.stdout | length == 0 or requests_unixsocket_check_py3.stdout.find("requests-unixsocket") == -1