For now I solved this with:
- debug: msg={{ item|replace(' ','') }}
with_items: "{{ droplet_inventory.stdout_lines}}"
if anyone knows a better method please share.
On Thursday, May 29, 2014 11:12:57 AM UTC-7, [email protected] wrote:
>
> hello, I am having a hard time finding anything in google on how to remove
> whitespace from the stdout results.
>
> Here is the play:
>
> tasks:
> - name: get droplet IPs from inventory
> shell: ansible -i hosts testing --list-hosts
> register: droplet_inventory
>
> - debug: msg="{{ item|e - }}"
> with_items: "{{ droplet_inventory.stdout_lines}}"
>
>
> output:
>
>>
>>> ok: [localhost] => (item= 10.128.164.13) => {
>>
>> "item": " 10.128.164.13",
>>
>> "msg": " 10.128.164.13"
>>
>> }
>>
>> ok: [localhost] => (item= 10.128.163.87) => {
>>
>> "item": " 10.128.163.87",
>>
>> "msg": " 10.128.163.87"
>>
>> }
>>
>> ok: [localhost] => (item= 10.128.163.89) => {
>>
>> "item": " 10.128.163.89",
>>
>> "msg": " 10.128.163.89"
>>
>> }
>>
>> ok: [localhost] => (item= 10.128.163.90) => {
>>
>> "item": " 10.128.163.90",
>>
>> "msg": " 10.128.163.90"
>>
>> }
>>
>>
>
> How can I get rid of the leading whitespace?
>
--
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/e4b6b942-5ce8-43ea-907e-fab3f7745b91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.