Skip to content

Instantly share code, notes, and snippets.

@till
Created January 16, 2019 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save till/90c8dfbca849e5f7588c6dc616ce64eb to your computer and use it in GitHub Desktop.
Save till/90c8dfbca849e5f7588c6dc616ce64eb to your computer and use it in GitHub Desktop.
---
- name: Start a service without a port
docker_container:
name: service_without_port
image: whatever
...
register: my_service_status
- name: Save status
set_fact:
container_is_running: "{{ my_service_status.ansible_facts.docker_container.State.Running }}"
- fail:
msg: "The service is not running"
when: not container_is_running
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment