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.

Revisions

  1. don-rumata created this gist Jan 21, 2021.
    33 changes: 33 additions & 0 deletions ping.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    ---
    # 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