Open antonroman opened 5 years ago
Currently we are using the commands below to get the list of PID from the containers:
- name: split stdout_lines into variable tags: - execute set_fact: blockdevices1: "{{list_of_containers.results|map(attribute='stdout')|list}}" - name: split stdout_lines into variable tags: - execute set_fact: blockdevices2: "{{blockdevices1[0].split('\n')}}" - name: get PID from containers tags: - prepare - execute shell: "docker inspect --format '{''{ .State.Pid }''}' {{ item }}" register: list_pids with_items: - "{{ blockdevices2 }}"
We should be able to get it using the code below directly however it doesn't seem to be working properly directly in the docker command:
with_items: - "{{ list_of_containers.results|map(attribute='stdout_lines')|list }}"
Need to check why this is not working as expected
Reference: https://carlosonunez.wordpress.com/2016/02/25/winning-at-ansible-how-to-manipulate-items-in-a-list/
Currently we are using the commands below to get the list of PID from the containers:
We should be able to get it using the code below directly however it doesn't seem to be working properly directly in the docker command:
Need to check why this is not working as expected