On 12.02.2019 18:20, Pandu jh wrote:
I need to reject "*" from stdout lines. all values from stdout_lines except
"*" symbol to be saved to "nfs_clients" variable

    "stdout_lines": [
        "rchinnn01",
        "rchinnn02",
        "*"
    ]

   - set_fact:
nfs_clients: "{{ nfs_clients_out.stdout_lines | reject('search','*') | list }}"

search takes regexp and * is a regexp special character so you need to escape it or just change search to equalto.
Your indentation is also off, nfs_clients need to extra spaces in front.

  - set_fact:
nfs_clients: "{{ nfs_clients_out.stdout_lines | reject('equalto','*') | list }}"


--
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 [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/8bb7e8004dcbcccbf08101cbd34a07e9%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to