2026-03-18 19:43:14 +00:00
2026-03-18 18:33:32 +00:00
2026-02-01 12:30:55 +01:00
2026-03-18 18:31:55 +00:00
2026-02-01 12:30:28 +01:00
2026-02-01 12:29:59 +01:00
2026-03-18 19:43:14 +00:00

Ansible

Setup

Rename inventory/inventory.example.yml to inventory/inventory.yml and adjust the host IPs and usernames as needed.

To install and use Ansible on Windows, follow the WSL Setup Instructions below or use the provided devcontainer setup.

Usage

run a playbook:

ansible-playbook playbooks/<playbook_name>.yml

run a playbook with sudo:

ansible-playbook playbooks/<playbook_name>.yml -K

WSL Setup Instructions

To use Ansible on Windows, you need to set up Windows Subsystem for Linux (WSL). You then have the option to open a local Folder in VSCode and open a WSL terminal that points to the same folder under WSL.


To enable proper file permissions for Ansible on WSL, you need to configure the WSL automount settings.

sudo nano /etc/wsl.conf

Add the following lines:

[automount]
enabled = true
options = "metadata,umask=022,fmask=0111"

If you use a Network Drive, you have to mount it manually:

sudo mkdir /mnt/<drive_letter>
sudo mount -t drvfs <drive_letter>: /mnt/<drive_letter> -o metadata,umask=022,fmask=0111

To mount it automatically on WSL start, add the following lines to /etc/fstab:

<drive_letter>: /mnt/<drive_letter> drvfs metadata,umask=022,fmask=0111 0 0

Reload fstab:

sudo mount -a

Remove others write permissions in your project folder:

sudo chmod -R o-w .

Install Ansible on WSL:

sudo apt update
sudo apt install ansible ssh-askpass

Add SSH Keys from Windows to WSL:

cp -r /mnt/c/Users/<username>/.ssh ~/.ssh
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub

Lastly, restart WSL to apply the changes:

sudo shutdown -r now
Description
No description provided
Readme 67 KiB
Languages
INI 100%