Skip to content

Instantly share code, notes, and snippets.

@reanim8ed
Last active May 24, 2024 22:38
Show Gist options
  • Save reanim8ed/7e9ca5eed9645c7475df4961eb929365 to your computer and use it in GitHub Desktop.
Save reanim8ed/7e9ca5eed9645c7475df4961eb929365 to your computer and use it in GitHub Desktop.
[Ansible through Windows Subsystem for Linux] #ansible

Bash on Ubuntu in Windows

  • Control Panel -> Programs and Features -> Turn Windows features on or off -> Check 'Windows Subsystem for Linux'. Windows will require a reboot.
  • Open Microsoft Store and seach for "linux", select Ubuntu and install. If store doesnt work, download manual install package: https://docs.microsoft.com/en-us/windows/wsl/install-manual
  • After install run in, you will need to create new user in linux installation

Installing Ansible

  • First update packages: sudo apt update
  • Install Pip: sudo apt-get -y install python-pip python-dev libffi-dev libssl-dev
  • Install Ansible: pip install ansible --user
  • Since the ansible commands are installed under ~/.local/bin, we need to add that to the $PATH, so run the command: echo 'PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
  • Update your $PATH to include Ansible: source .bashrc
  • Check installation: ansible --version

Run ansible playbook

  • ansible-playbook playbook.yml -i hosts.ini

SShpass

  • If error on connecting to server: {"msg": "to use the 'ssh' connection type with passwords, you must install the sshpass program"} fix that with: apt-get install sshpass
@CypherpunkSamurai
Copy link

it will be python3-dev

sudo apt-get -y install python-pip python3-dev libffi-dev libssl-dev python3-pip
pip install ansible --user
echo 'PATH=$HOME/.local/bin:$PATH' >> ~/.bashrc
source .bashrc
ansible --version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment