Skip to content
Snippets Groups Projects

Installation

This has only been tested on Linux. But it should work the same way for MacOS or Windows WSL.

Repository

Clone this repository on your computer:

git clone https://git.ubicast.net/mediaserver/envsetup.git

# enter inside the cloned repository
cd envsetup/

Every commands are assumed to be launched from the envsetup directory.

Make

For convenience we use the make tool, please install it.

For example, on a Debian-based distribution:

sudo apt install make

Otherwise you can look at the Makefile to see which commands are ran.

Ansible

There are many way to install Ansible, choose one below.

Virtual environment

make requirements

Alternatively you can manually create a virtual environment with Python's venv or with the package virtualenv. For this example i will use the former one.

# create the venv
python3 -m venv .venv

# activate the venv
source .venv/bin/activate

# install requirements (inside the activated venv)
python3 -m pip install -U pip wheel
python3 -m pip install -r requirements.txt

If you want to exit the venv:

deactivate

Docker

If you do not want to bother with Python, virtual environment and Ansible on your computer (even though it is isolated inside a venv), you can use Docker.

docker run \
  `# run an interactive pseudo-TTY` \
  -it \
  `# remove the container once you leave it` \
  --rm \
  `# share the current directory` \
  -v $(pwd):/workspace \
  `# share your SSH configuration` \
  -v $HOME/.ssh:/home/code/.ssh:ro \
  `# share your SSH agent` \
  -v $SSH_AUTH_SOCK:/ssh-agent:ro \
  `# let container know where is mapped the SSH agent` \
  -e SSH_AUTH_SOCK=/ssh-agent \
  `# container image to use` \
  registry.ubicast.net/mediaserver/envsetup \
  `# executable to run` \
  bash

Make sur to share your SSH configuration with the Docker container, this may require to adapt the example command.

Pip

You can also install Ansible and its dependencies on your operating system, but it is not recommend since it may conflicts with existing packages.

This will install requirements into your user's path (~/.local/bin must be in your PATH in order to work):

python3 -m pip install --user -r requirements.txt

Even least recommended, install into system's path:

sudo python3 -m pip install -r requirements.txt

Distribution packages

Depending on your distribution you may be able to install Ansible from repositories, but the provided version may be outdated (< 2.8 will certainly not work).

For example, on a Debian-based distribution:

sudo apt install \
  ansible \
  python3-netaddr \
  python3-pyyaml \

Take a look at the requirements in requirements.in file.

Testing

To make sure Ansible is properly installed, run this command:

ansible --version

The output should like like this:

ansible 2.9.1
  config file = /workspace/ansible.cfg
  configured module search path = ['/workspace/library']
  ansible python module location = /home/code/pyvenv/lib/python3.7/site-packages/ansible
  executable location = /home/code/pyvenv/bin/ansible
  python version = 3.7.3 (default, Apr  3 2019, 05:39:12) [GCC 8.3.0]