kikas
kikas

Reputation: 137

How to get a value from a list using ansible

i'm actually using ansible and i need to parse a result

result { "stdout_lines":[
"# Replication", "name:ave", "host:10.10.10.10", "connected_clients:0", "repl_backlog_active:1", "repl_backlog_size:1048576", "repl_backlog_first_byte_offset:90804100", "repl_backlog_histlen:1048576" ] }

how can i get the "name" value from this list ?

Thank you

Upvotes: 0

Views: 84

Answers (1)

Pavan Srinivas
Pavan Srinivas

Reputation: 106

This should work

debug: var=result.stdout_lines[1].split(':')[1]

Upvotes: 1

Related Questions