Skip to content

Instantly share code, notes, and snippets.

@cchurch
Created July 25, 2015 16:49
Show Gist options
  • Save cchurch/305a2eafad8f78116755 to your computer and use it in GitHub Desktop.
Save cchurch/305a2eafad8f78116755 to your computer and use it in GitHub Desktop.
Proof of concept to run Python ping module on Windows with Ansible
---
- hosts: windows
gather_facts: false
vars:
ansible_python_interpreter: python
tasks:
- win_chocolatey:
name: python2
state: present
- raw: python --version
- raw: python -m easy_install --version
register: check_easy_install
ignore_errors: true
- raw: (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | python -
when: check_easy_install|failed
- raw: python -m pip --version
register: check_pip
ignore_errors: true
- raw: python -m easy_install pip
when: check_pip|failed
- raw: python -c "import ansible_windows_compat"
register: check_ansible_windows_compat
ignore_errors: true
- raw: python -m pip install https://github.com/cchurch/ansible-windows-compat/archive/master.zip
when: check_ansible_windows_compat|failed
- action: ping.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment