Skip to content

Instantly share code, notes, and snippets.

@CypherpunkSamurai
Forked from reanim8ed/sample.md
Last active May 24, 2024 22:39
Show Gist options
  • Save CypherpunkSamurai/0747c051c32dc3df0ece494dd1b4b995 to your computer and use it in GitHub Desktop.
Save CypherpunkSamurai/0747c051c32dc3df0ece494dd1b4b995 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 python3-pip python3-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

Quick Install

sudo apt-get -y install python3-pip python3-dev libffi-dev libssl-dev
pip install ansible
ansible --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment