# Ansible AWX (Tower)

before installing - you need some ansible for integrate everything related with ansible awx.

get new pip package manager version:

```bash
curl https://bootstrap.pypa.io/get-pip.py | python
```

install ansible:

```bash
pip3 install ansible
```

on void linux, just install via ```xbps-install``` package manager:

```bash
xbps-install -S ansible
```

## Installing

it's not a simple installation with ```docker-compose``` commands only.

for first step, just download interesting version:

```bash
wget https://github.com/ansible/awx/archive/refs/tags/17.1.0.tar.gz
```

Once the AWX is downloaded, unzip the downloaded file with the following command:

```bash
tar -xvf 17.1.0.tar.gz
cd awx-17.1.0/installer
```

generate hash:

```bash
echo  "sakdaslnaksdlln" | openssl dgst -sha256
```

lets edit all of these records in ```inventory``` file:

```bash
admin_user=admin
admin_password=admin
secret_key=<generated_before_sha256_hash>
```

let's install awx (if you user is not a ```docker``` group member - use sudo):

```bash
sudo ansible-playbook -i inventory install.yml
```

if you have any problem like that:

```bash
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ModuleNotFoundError: No module named 'requests'
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import the required Python library (Docker SDK for Python: docker>=5.0.0 (Python >= 3.6) or docker<5.0.0 (Python 2.7)) on void.node.00's Python /usr/bin/python3. Please read the module documentation and install it in the appropriate location. If the required library is installed, but Ansible is using the wrong Python interpreter, please consult the documentation on ansible_python_interpreter, for example via `pip install docker` (Python >= 3.6) or `pip install docker==4.4.4` (Python 2.7). The error was: No module named 'requests'"}
```

just install ```python3-docker``` package (https://stackoverflow.com/questions/59384708/ansible-returns-with-failed-to-import-the-required-python-library-docker-sdk-f):

```bash
sudo xbps-install -S python3-docker
```

and some python packages (https://stackoverflow.com/questions/50151210/ansible-unable-to-run-docker-compose-in-an-ansible-playbook):

```bash
pip uninstall docker docker-py docker-compose
pip install docker-compose
```

```bash
sudo xbps-remove -of ansible
sudo xbps-install -S ansible
```

if this problem still exist - just use this (https://stackoverflow.com/questions/50151210/ansible-unable-to-run-docker-compose-in-an-ansible-playbook - second answer):

```bash
sudo pip install docker-compose
```
