> For the complete documentation index, see [llms.txt](https://ploegert.gitbook.io/til/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ploegert.gitbook.io/til/tools/ansible-1/setup-ansible-on-wsl1.md).

# Setup Ansible on WSL1

We had a bit of a struggle to get ansible to work with all the dependencies - the following seemed to work for me

### Setup Ansible on WSL2

```bash
sudo apt-get update -y
sudo apt-get upgrade -y
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 ./get-pip.py
sudo python3 -m pip install ansible pywinrm
sudo python3 -m pip install ansible[azure]

export AZURE_SUBSCRIPTION_ID=SOMESECRET
export AZURE_CLIENT_ID=SOME_CLIENT
export AZURE_SECRET=SOME_SECRET
export AZURE_TENANT=SOME_TENANT

export VAULT_ADDR=SOME_URL
export VAULT_TOKEN=SOME_TOKEN

sudo ansible-galaxy collection install azure.azcollection --force
sudo python3 -m pip install -r ~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt


pip install ansible-modules-hashivault
sudo python3 -m pip install ansible-modules-hashivault
sudo ansible-galaxy install 'git+https://github.com/TerryHowe/ansible-modules-hashivault.git'

cd /mnt/c/vso/OBT.Loki/deploy/ansible/
ansible-playbook infra_all.yml
```

Then i wanted to execute our first ansible script:

```bash
cd /mnt/c/vso/OBT.Loki/deploy/ansible/
ansible-playbook infra_all.yml
```

### Setup Azure Function Tools

```bash
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
sudo apt-get update
sudo apt-get install azure-functions-core-tools-3
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ploegert.gitbook.io/til/tools/ansible-1/setup-ansible-on-wsl1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
