pulitux 2 лет назад
Родитель
Сommit
6248f1b04e
3 измененных файлов с 8 добавлено и 7 удалено
  1. BIN
      ping/.ping.yml.swp
  2. 3 7
      ping/ping.yml
  3. 5 0
      ping/playbook.yml

BIN
ping/.ping.yml.swp


+ 3 - 7
ping/ping.yml

@@ -1,12 +1,8 @@
 - name: ping
-  ping:
+  command: "ping -c1 {{ ping_address }}"
   register: retorno
-  ignore_unreachable: true
-
-- name: escupe reurn
-  debug:
-    var: retorno
+  ignore_errors: true
 
 - name: recursivo
   include_tasks: ping.yml
-  when: retorno.ping is undefined
+  when: retorno.failed

+ 5 - 0
ping/playbook.yml

@@ -1,5 +1,10 @@
 - name: prueba ping
   hosts: all
   gather_facts: no
+  vars:
+    - ping_address: 192.168.1.32
   tasks:
     - include_tasks: ping.yml
+    - name:
+      debug:
+        msg: "Address {{ ping_address }} responding ping from {{ inventory_hostname }}"