Installing Ansible and Molecule in Arch Linux

Using “pip” is the supported installation method for Ansible and Molecule. Let’s install Python libraries and applications (in this case, Ansible and Molecule) in a Python virtual environment. (This post is similar to the one about Ubuntu.)

First, install the required packages, including the Python virtual environment package:

Create a virtual environment somewhere (in this example, I create it in my home folder as a subdirectory of a folder for all the virtual environments; the directory will be created automatically):

Once the virtual environment has been created, “enter” the virtual environment:

Install the Python packages for Ansible, Molecule, and its plugins in the virtual environment:

You can verify that everything is installed correctly, e.g., at the time of writing:

Each time you want to run Ansible or Molecule, just run the “source” command above:

And then you can run “ansible” and “molecule”.

When using “Oh My Zsh” with the “Powerlevel10k” theme, you also get the virtual environment name shown in the prompt:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.