![]() Since Ansible is not part of Conda's default channels, the -c is used to search and install from an alternate channel. ![]() (ansible-env) $ conda install -c conda-forge ansible To install a relatively recent version of Ansible, use: (base) $ conda activate ansible-env Conda provides the flexibility both to keep everything separated and to add in other new environments as needed (as I'll demonstrate later). There are various ways to install Ansible, but using Conda keeps the Ansible version and all desired dependencies packaged in one place. This will bring you back to the base: conda activate base. You can always switch out of a virtual environment and into another with Conda's activate command. The third command is not required it lists what Python modules are installed with their version and other data. It sets the proper paths for Python and the modules it contains. Notice that your shell prompt changes after the conda activate ansible-env command. The second command changes the shell context to this new ansible-env environment. The clone brings in the Python 3.7 version and a bunch of default Python modules that you can add to, remove, or upgrade as needed. The first command clones the Conda base into a new virtual environment called ansible-env. I want to keep Ansible separate from my other Python projects, so I created a new virtual environment and switched over to it: (base) $ conda create -name ansible-env -clone base Creating a virtual environment for Ansible Now that Conda is installed, the next step is to set up a virtual environment, then get Ansible installed and running. Running the usual Python version check should prove this, and your PATH will point to the new location: (base) $ which python Now that the base is installed, you have your first Python virtual environment. bash_profile updated with Conda-specific settings The shell prompt modified to prepend the word "(base)".A new miniconda3 directory in your home.The install took about 158MB of space on my system.Īfter the installation, bring up a terminal to see what you have. To install Conda, download the PKG format file, do the usual double-click, and select the "Install for me only" option. Regardless of which version you select, you can always install new virtual environments with other versions of Python. I chose the Miniconda Python 3.7 installation for my workstation because I wanted the latest Python version. Surf on over to the Conda documentation for all the details. If you are manually managing Python virtual environments, Conda will help streamline and manage your work. It can help you manage multiple versions of Python, install package dependencies, perform upgrades, and maintain project isolation. Installing CondaĬonda is an open source utility that provides convenient package- and environment-management features. Since Ansible is based on Python, Conda seemed to be the ideal solution. I set out to see how to get a flexible but isolated Ansible system on native MacOS. ![]() This provided a real level of safe isolation, but I soon found that managing it was tedious. So, I started my Ansible work using a local Ubuntu 18.04 virtual machine. I really wanted to use Python 3.7, but MacOS packages the older 2.7, and I was not going to install any global Python packages that might interfere with the core MacOS system. I especially dislike applying manual updates to the vendor's default OS installation (a preference I developed from years of Unix system administration). I am generally wary of installing things into my daily use workstation. Recently, I wanted to learn Ansible, so I needed to figure out the best way to install it. Read on to learn how to install Conda, create a new virtual environment, install Ansible, and test it. This article focuses on using Conda to manage Ansible as a Python project to keep it clean and separated from other projects. I find this to be simpler rather than trying to load a Python version and dependencies into the system or in /usr/local, Conda helps me corral everything I need for Ansible into a virtual environment and keep it all completely separate from other projects. You could use Homebrew, but if you are into Python development (or Ansible development), you might find managing Ansible in a Python virtual environment reduces some confusion. There are other ways to install Ansible on MacOS. This allows you to use an upgraded Python version on MacOS and keep Python package dependencies separate between your system, Ansible, and other programming projects. ![]() Conda is not required to make Ansible work on MacOS, but it does make managing Python versions and package dependencies easier. If you are a Python developer using MacOS and involved with Ansible administration, you may want to use the Conda package manager to keep your Ansible work separate from your core OS and other local projects.Īnsible is based on Python.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |