I usually use the python from that venv explicitly in my command, for example:
/opt/venv/bin/python3 /some/script.py On Fri, 16 Sep 2022 at 08:28, Fenrir Sivar <[email protected]> wrote: > I would like to run a shell command using a python virtual environment on > a remote server. > (collecting static files for a django project) > However, how do I activate a remote virtual environment in a task? > > Best Fen > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/a08620f5-1aed-4b6d-a61b-a02c9539d265n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/a08620f5-1aed-4b6d-a61b-a02c9539d265n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Sent from Gmail Mobile -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAF8BbLa-wsxYeiTNJy%3DEi5-%2B3GDSKgKsnTj9OZG_gqJ8VYUOWg%40mail.gmail.com.
