I have the following playbook: 

```
---
- hosts: lxc_hosts
  name:  get list of lxc containers on lxc host
  tasks:
  - name: get list of containers
    shell: >
      lxc-ls | awk -vRS= -vFS="\n" '//'
    register: containers
  - debug: msg="{{containers.stdout}}"

```

The debug returns values like this:

```
TASK [debug] *******************************************************************
ok: [10.1.1.1] => {
    "msg": "container1\ncontainer2\ncontainer3"
}
ok: [10.1.1.2] => {
    "msg": "container22\ncontainer23\ncontainer24"
}

```

I'm hoping there's a way to parse the results I get back into a list like this: 

```
container1
container2
container3

```

and / or 

```
container22
container23
container24

```

And then somehow I'd like to be able to loop through these lists and run another play against them. Something like this: 

```
shell:  lxc-attach --name={{item}}
register: attach_results
with_items:  <list of containers>

```

How would I go about doing this?