Added split('\n')

This commit is contained in:
Vadim Shulkin 2025-03-04 10:59:27 -05:00
parent b4c14b9168
commit 721414ce29
2 changed files with 17 additions and 8 deletions

10
1 Normal file
View File

@ -0,0 +1,10 @@
Added
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch main
# Your branch is up to date with 'origin/main'.
#
# Changes to be committed:
# modified: run_python_script.yml
#

View File

@ -18,13 +18,13 @@
virtualenv: /tmp/ansible_venv
virtualenv_command: "python3 -m venv"
- name: Check installed Python packages
command: bash -c "source /tmp/ansible_venv/bin/activate && pip list"
register: installed_packages
# - name: Check installed Python packages
# command: bash -c "source /tmp/ansible_venv/bin/activate && pip list"
# register: installed_packages
- name: Show installed packages
debug:
msg: "{{ installed_packages.stdout }}"
# - name: Show installed packages
# debug:
# msg: "{{ installed_packages.stdout }}"
- name: Run the Python script
command: /tmp/ansible_venv/bin/python3 scripts/my_script.py
@ -32,7 +32,6 @@
- name: Show script output
debug:
msg: "{{ script_output.stdout }}"
msg: "{{ script_output.stdout.split('\n') }}"