Filter line from Ansible stdout_lines result

Question:

I am trying to filter out a line out of Ansible stdout_lines result. The ansible playbook task I ran was the following shell argument:

To see the results, I followed it up with a debug:

which gives the following result during the playbook run:

I want ONLY the last url, “test_sqs” to appear under “msg”:, I tried the following filter but had no luck:

Answer:

Script:

Output:

You can make use of the --queue-name-prefix parameter to list only queues which is starting with name test_sqs. If there is only one queue with that name, you can use this solution.

Leave a Reply