Setting up Ansible on Cygwin

Here is basic info for setting up Ansible under Cygwin:

1. Make sure python3-pip is installed

2. Run pip3 install ansible to install Ansible. I’m not listing all the required packages here, which you can find elsewhere.

3. Run pip3 install –upgrade pip to upgrade Ansible to the latest version

4. Create the directory /etc/ansible

5. Create the file /etc/ansible/ansible.cfg with the following contents:

[ssh_connection]
ssh_args = -o ControlMaster=no

6. Create the file /etc/ansible/hosts Make sure you’ve set up SSH pre-shared key authentication with the hosts so that they don’t require a password to login from your Ansible control machine. Here’s an example hosts file:

foo ansible_host=192.168.0.10
bar ansible_host=184.161.5.9 ansible_user="jschmoe"
baz ansible_host=foo345.somewhere.com ansible_port=2222 ansible_user="bsmith"

7. The command ansible all -m ping should be able to successfully connect with all the hosts.

8. You can run a command on an individual host like:

ansible bar -a "/bin/hostname"

9. Check out the Ansible Getting Started documentation.

Credit: thanks to oznetnerd.com: Installing Ansible on Windows and to this Github issue post.