# Ansible

## (Optional) Preparing a virtual environment for Ansible <a href="#id-razvertyvanieklasteradekube-opcionalno-podgotovkavirtualnogookruzheniyadlyaansible" id="id-razvertyvanieklasteradekube-opcionalno-podgotovkavirtualnogookruzheniyadlyaansible"></a>

If you don’t want to install dependencies for Ansible on a working machine, then you can use Python’s ability to create a virtual environment and work in it:

```sh
VENVDIR=kubespray-venv
KUBESPRAYDIR=kubespray
python3 -m venv $VENVDIR
source $VENVDIR/bin/activate
```

{% hint style="info" %}
All further commands should be executed from the dekube\_cluster\_deploy directory (unpacked archive).
{% endhint %}

## Preparing the environment for Ansible <a href="#id-razvertyvanieklasteradekube-podgotovkaokruzheniyadlyaansible" id="id-razvertyvanieklasteradekube-podgotovkaokruzheniyadlyaansible"></a>

For the **offline-setup**: in the root of the unpacked repository execute:

```sh
cd pip3
pip3 install *.whl
cd ..
```

For the **online-setup** in the root of the repository execute:

```sh
pip3 install -U -r requirements.txt --no-cache-dir
```

***

## Installing roles and dependencies for Ansible <a href="#id-razvertyvanieklasteradekube-ustanovkaroleiizavisimosteidlyaansible" id="id-razvertyvanieklasteradekube-ustanovkaroleiizavisimosteidlyaansible"></a>

For the **offline-setup**: in the root of the repository execute:

```sh
cd collections
ansible-galaxy install collections -r requirements.yml
cd ..
```

For the **online-setup:** in the root of the repository execute:

```sh
ansible-galaxy install collections -r requirements.yml
```

To watch a video tutorial that demonstrates the correct process for installing dependencies, you can view it: [here](https://asciinema.org/a/kqk5TpC0ML7U97QbXxh0CFmlu).&#x20;
