Skip to content

Instantly share code, notes, and snippets.

@don-rumata
Created January 21, 2021 21:26
Show Gist options
  • Save don-rumata/9ad1d4d99fa3d1cfbea700f86a7a6e34 to your computer and use it in GitHub Desktop.
Save don-rumata/9ad1d4d99fa3d1cfbea700f86a7a6e34 to your computer and use it in GitHub Desktop.
Simple Ansible ping any Linux and Windows
---
# WORK
- name: Ping
hosts: all
strategy: free
serial:
- "100%"
tasks:
- name: Ping 4 Windows
when: ansible_os_family == 'Windows'
become: yes
become_method: runas
# become_user: "{{ ansible_user }}"
become_flags: logon_type=new_credentials logon_flags=netcredentials_only
block:
- win_ping:
register: ping_win
# - debug:
# msg: "{{ ping_win }}"
# - local_action: lineinfile line="{{ ansible_hostname }} {{ ping_win }}" path=/tmp/ping-ansible
tags:
- windows
- ping
- name: Ping 4 any linux
when:
- ansible_system == 'Linux'
# Пашет!!!
# - ansible_version.full == '2.9.6.sdfsdfs'
ping:
register: ping_linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment