diff options
| author | Carlos Konstanski <ckonstanski@pippiandcarlos.com> | 2017-11-13 16:50:55 -0700 |
|---|---|---|
| committer | Carlos Konstanski <ckonstanski@pippiandcarlos.com> | 2017-11-13 16:50:55 -0700 |
| commit | ffa2a169ea98fb54a29d90ca158059e79e2816ba (patch) | |
| tree | 018461d031b71178fa48b9672d8e39bac4de1270 /playbooks/stop_start_openbook.yaml | |
initial commit
Diffstat (limited to 'playbooks/stop_start_openbook.yaml')
| -rw-r--r-- | playbooks/stop_start_openbook.yaml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/playbooks/stop_start_openbook.yaml b/playbooks/stop_start_openbook.yaml new file mode 100644 index 0000000..83c1d57 --- /dev/null +++ b/playbooks/stop_start_openbook.yaml @@ -0,0 +1,28 @@ +--- +- name: "Verify action to take" + hosts: localhost + tasks: + - name: "Check that -e 'action=[stop|start]' was passed in" + fail: msg="The variable 'action' was not passed in with a value of 'stop' or 'start' on the command line." + when: action not in ["stop", "start"] + +- name: "Stop Openbook" + hosts: "{{ groups['target']|sort(reverse=True) }}" + serial: 1 + tasks: + - name: "Stop Openbook" + shell: | + /etc/init.d/openbook stop + for cont in $(docker ps | grep -v 'COMMAND' | awk '{print $1}'); do + docker stop ${cont} + done + docker container prune -f + when: action == "stop" + +- name: "Start Openbook" + hosts: "{{ groups['target']|sort }}" + serial: 1 + tasks: + - name: "Start Openbook" + shell: /etc/init.d/openbook start + when: action == "start" |
