using ansible, i want to stop all running docker container except for the container whose name I will specify
I have tried to get the container info
- name: Get info on docker host and list images
docker_host_info:
containers: yes
register: docker_info
- name: Stop running docker containers
docker_container:
name: '{{ item.Names.0}}'
state: stopped
loop: '{{ docker_info.containers }}'
when: ??
the when condition is what I’m not sure how to do?
Im still new to ansible, hope someone give me advice