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?