Reputation: 103
I have the following on my playbook:
- name: Debug
debug:
msg: "{{ item.stdout }}"
with_items:
- "{{ tapip.results }}"
- "{{ hostname.results }}"
Which returns me this:
TASK [Debug] *************************************************************************************************************************************************************************************************** ok: [localhost] => (item=None) => { "msg": "192.168.0.104" } ok: [localhost] => (item=None) => { "msg": "hostname1" }
I would like to break the hostname and ip into 2 different strings. What is the best way to achieve this?
btw, I have also tried the following:
- name: Debug
debug:
msg: "{{ item.stdout.0 }} {{ item.stdout.1 }}"
with_items:
- "{{ tapip.results }}"
- "{{ hostname.results }}"
Which returns this:
TASK [Debug] *************************************************************************************************************************************************************************************************** ok: [localhost] => (item=None) => { "msg": "1" } ok: [localhost] => (item=None) => { "msg": "h" }
Any ideas would be appreciated
Upvotes: 0
Views: 271
Reputation: 34
Upvotes: 0
Reputation: 34
Try this
Upvotes: 1