solution
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
---
|
||||
- hosts: centos
|
||||
tasks:
|
||||
|
||||
- name: print a message
|
||||
debug:
|
||||
msg: "OS on {{ inventory_hostname }} is {{ ansible_distribution }}"
|
||||
|
||||
- name: send script
|
||||
copy:
|
||||
src: "{{ item }}"
|
||||
dest: /tmp/
|
||||
mode: 0750
|
||||
loop:
|
||||
- random.sh
|
||||
- bad.sh
|
||||
|
||||
- name: execute bad script
|
||||
command: "/tmp/bad/sh"
|
||||
ignore_errors: true
|
||||
|
||||
- name: execute random script
|
||||
command: /tmp//random.sh
|
||||
register: result
|
||||
failed_when: 2|string in result.stdout
|
||||
|
||||
- name: display result
|
||||
debug:
|
||||
var: result
|
||||
when: 1|string in result.stdout
|
||||
Reference in New Issue
Block a user