Skip to content

Commit

Permalink
Stops/removes any running container
Browse files Browse the repository at this point in the history
This is done to ensure there's nothing else running on the docker hosts
  • Loading branch information
ivotron committed Feb 22, 2017
1 parent 3433859 commit 6bffe97
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 16 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
- name: stop any running container
shell: "docker stop `docker ps -q` || docker rm `docker ps -q`"
ignore_errors: true

- name: ensure benchmarks dict exists
assert:
that:
Expand All @@ -9,6 +13,18 @@
results_path: "./results/"
when: 'results_path is undefined'

- name: remove remote results folder
file:
path: '{{ remote_results_path }}'
state: absent
become: true

- name: create remote results folder
file:
path: '{{ remote_results_path }}'
state: directory
mode: 0755

- name: ensure benchmark output folder exists
local_action:
module: file
Expand Down
7 changes: 0 additions & 7 deletions tasks/run-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
set_fact:
docker_flags: ''

- name: stop container
shell: 'docker stop $(docker ps -aq --filter ancestor={{ bench.image }})'
ignore_errors: true
- name: remove container
shell: 'docker rm $(docker ps -aq --filter ancestor={{ bench.image }})'
ignore_errors: true

- name: add environment to docker_flags
set_fact:
docker_flags: '{{ docker_flags }} -e {{ item.key }}="{{ item.value }}"'
Expand Down

0 comments on commit 6bffe97

Please sign in to comment.