Created
July 24, 2020 07:54
-
-
Save kjelly/1c4d0f563204237f8e04433f201ef560 to your computer and use it in GitHub Desktop.
restart docker container by ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: restart {{ service }} | |
hosts: | |
- "all" | |
gather_facts: no | |
tasks: | |
- name: Collect only facts returned by facter | |
setup: | |
filter: "ansible_date_time*" | |
gather_subset: | |
- '!all' | |
- '!any' | |
- facter | |
- shell: docker ps -a --format '{'{.Names}'}'|grep {{service}}|xargs docker restart | |
register: out | |
become: yes | |
- debug: var=out | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment