Thanks kai, But what if i want to grep days from output and then write condition on it. Is it possible.
Now it will not possible for most of the thing to have direct implementation. Hence can we grep >100 days from output and then restart. On Thursday, August 10, 2017 at 10:54:36 PM UTC+5:30, Kai Stian Olstad wrote: > > On 10. aug. 2017 11:25, Sameer Modak wrote: > > I could rit playbook to get uptime but how we can take action on the > output > > received from ansible. > > how we can grep days from below output and rit restart code for the > same. > > > > ok: [NESSTDDB01] => { > > "result.stdout": " 12:03pm up 343 days 16:57, 1 user, load > average: > > 5.15, 5.37, 5.21" > > > > If days are greater than 100 then restart node > > > > how we can achieve this. > > Why not just use ansible fact > > - name: Restart server > shell: sleep 2 && /sbin/reboot > async: 1 > poll: 0 > when: ansible_uptime_seconds > 8640000 > > -- > Kai Stian Olstad > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to ansible-project+unsubscr...@googlegroups.com. To post to this group, send email to ansible-project@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/c4979353-e5dd-4a05-bc4a-b40df38d43ac%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.