Reputation: 576
I am using Ansible from a pipeline agent, to configure Ubuntu VMs and I would like to use the azure_rm_storageblob and mssql_script module directly on the Ubuntu VM that I am configuring. I had some issues running this, because the packaging module was not installed on the hosts.
Is there a way to install the pip modules only for use when I run Ansible (maybe a virtual environment), as I don't want to mess with the pip modules that are installed on the server for other purposes.
If this is done using something like a python virtual env, how do I make sure that this is used when I connect to the VM using Ansible?
Upvotes: 3
Views: 1356
Reputation: 737
You have to use virtual environments to solve that problem (link to the python doc)
First you create the environment with :
python -m venv venv
Then depending on your OS, you have to activate you virtual environment, on Unix you can do :
source venv/bin/activate
The name of you virtual env should be written in your terminal, at that point you know you are using it and not the default python env.
Upvotes: 2