Hi Piyush,
Using the below Jinja2 filter, able to extract the value 2160063879L.
However need to extract exact numeric value alone from sub String by
eliminating the letter 'L' from the output. Any help much appreciated.
- set_fact:
upTime: "{{ status.stdout.split()[-2] }}"
delegate_to: localhost
become: false
become_user: awx
when: status.rc | int == 0
ignore_errors: yes
STANDARD OUTPUT
2160063879L
On Monday, 31 December 2018 12:55:00 UTC-5, Piyush Bansal wrote:
>
> Hello Saravanan,
>
> Have you tried "Regular Expression Filters" (regex_search) ??
>
> On Sun, Dec 30, 2018 at 8:44 AM Saravanan <[email protected] <javascript:>>
> wrote:
>
>> Hi Ansible experts,
>>
>> {
>> "outcome" => "success",
>> "result" => "running"
>> }
>> {
>> "outcome" => "success",
>> "result" => 2160063879L
>> }
>>
>> Please help to filter the string running and the numeric value 2160063879
>> from the above stdout output using jinja2 filter into two different
>> variables.
>>
>> --
>> 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 [email protected] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/ansible-project/133888b5-6b7d-4397-90ee-66a7d6c7a343%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/ansible-project/133888b5-6b7d-4397-90ee-66a7d6c7a343%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/46ee03e9-bb20-47a3-bf61-d8d27224db2a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.