blob: 4c13a14fd01230120b4ddb30f0d841ede4e8454f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
---
- name: Restart app on clever
hosts: localhost
remote_user: root
pre_tasks:
- file:
state: absent
path: ../clever-commands
roles:
- role: clever
vars:
clever_token: 123abc
clever_secret: cba321
clever_app: app_00000000-0000-0000-0000-000000000000
clever_restart_only: true
post_tasks:
- name: Check stubbed commands
command: "{{ item.cmd }}"
ignore_errors: true
vars:
display: "{{ item.display }}"
with_list:
- cmd: "grep restart ../clever-commands"
display: "Expected 'clever restart' command to be called"
- cmd: "grep -v deploy ../clever-commands"
display: "Expected 'clever deploy' command to NOT be called"
- cmd: "grep -v scale ../clever-commands"
display: "Expected 'clever scale' command to NOT be called"
register: tests_results
- name: show results
debug:
msg:
- "failed_results: {{ failed_results }}"
- "success_results: {{ success_results }}"
failed_when: tests_results is failed
vars:
failed_results: "{{ tests_results.results | selectattr('failed') | map(attribute='item.display') | list }}"
success_results: "{{ tests_results.results | rejectattr('failed') | map(attribute='item.display') | list }}"
|