From Subtle Owl, 4 Months ago, written in Plain Text.
  1. My playbook
  2.  
  3. ============================
  4.  
  5. ---
  6. - hosts: "{{ variable_host }}"
  7.   gather_facts: yes
  8.   tasks:
  9.     - name: Gather facts about uptime
  10.       setup:
  11.           gather_subset=all
  12.       register: uptime
  13. #### commented line     - debug: msg="{{ uptime.ansible_facts.ansible_lastboot }}"
  14.  
  15.     - lineinfile:
  16.         path=/space/RebootReport.txt line="{{ uptime.ansible_facts.ansible_lastboot }}" insertafter="EOF"
  17.         state=present
  18.       delegate_to: 127.0.0.1
  19.      
  20. ================================
  21.  
  22.  
  23. Output
  24.  
  25. =================================
  26.  
  27.  
  28. PLAY [reboot1amJeudi] ***********************************************************************************************************************************************************************************************************************
  29.  
  30. TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************
  31. ok: [x0034o]
  32. ok: [x0020j]
  33. ok: [x0032m]
  34. ok: [x0033n]
  35. ok: [x0031l]
  36. ok: [x0002o]
  37. ok: [x0026r]
  38. ok: [x0013i]
  39. ok: [x0014j]
  40. ok: [x0027s]
  41. ok: [x0015k]
  42.  
  43. TASK [Gather facts about uptime] ************************************************************************************************************************************************************************************************************
  44. ok: [x0020j]
  45. ok: [x0033n]
  46. ok: [x0032m]
  47. ok: [x0034o]
  48. ok: [x0031l]
  49. ok: [x0002o]
  50. ok: [x0013i]
  51. ok: [x0014j]
  52. ok: [x0026r]
  53. ok: [x0015k]
  54. ok: [x0027s]
  55.  
  56. TASK [lineinfile] ***************************************************************************************************************************************************************************************************************************
  57. changed: [x0033n -> 127.0.0.1]
  58. changed: [x0031l -> 127.0.0.1]
  59. changed: [x0020j -> 127.0.0.1]
  60. changed: [x0034o -> 127.0.0.1]
  61. ok: [x0032m -> 127.0.0.1]
  62. ok: [x0013i -> 127.0.0.1]
  63. ok: [x0014j -> 127.0.0.1]
  64. ok: [x0026r -> 127.0.0.1]
  65. changed: [x0015k -> 127.0.0.1]
  66. changed: [x0002o -> 127.0.0.1]
  67. ok: [x0027s -> 127.0.0.1]
  68.  
  69. PLAY RECAP **********************************************************************************************************************************************************************************************************************************
  70. x0013i               : ok=3    changed=0    unreachable=0    failed=0  
  71. x0014j               : ok=3    changed=0    unreachable=0    failed=0  
  72. x0015k               : ok=3    changed=1    unreachable=0    failed=0  
  73. x0002o               : ok=3    changed=1    unreachable=0    failed=0  
  74. x0020j               : ok=3    changed=1    unreachable=0    failed=0  
  75. x0031l               : ok=3    changed=1    unreachable=0    failed=0  
  76. x0032m               : ok=3    changed=0    unreachable=0    failed=0  
  77. x0033n               : ok=3    changed=1    unreachable=0    failed=0  
  78. x0034o               : ok=3    changed=1    unreachable=0    failed=0  
  79. x0026r               : ok=3    changed=0    unreachable=0    failed=0  
  80. x0027s               : ok=3    changed=0    unreachable=0    failed=0  
  81.  
  82. ============================
  83.  
  84.  
  85.  
captcha