Hi All,

I am new to ansible, and i have a script which i use on many hosts.

The command i execute is 
 

*ansible-playbook main.yml -i hosts*


here is my code in the main.yml
 

*---*

*- hosts: group*

*  sudo: true*

*  user: root*


*  tasks:*

*  - name: Clean logs*

*    script: Clean.sh*

*    register: myEcho*


*  - name: Debug*

*    debug: msg="{{ myEcho.stdout_lines }}"*


Here is the script that i execute using the Ansible task:

*echo '====================== cb-backend-00 ======================'*

*echo '======================== CleanLogsOld ========================='*

*du -h /opt/test/logs/logs.old/ --max-depth=0*

*if ls /opt/test/logs/logs.old/* 1> /dev/null 2>&1; then*

*  echo "There are files under the Old Logs Folder"*

*  rm -rf /opt/test/logs/logs.old/**

*else*

*  echo "====== No Files exist under the Old Logs folder"*

*fi*

*exit*


Here is the output that i get:

*PLAY [group] 
******************************************************************** *


*GATHERING FACTS 
*************************************************************** *

*ok: [20.152.30.10]*


*TASK: [Clean BVT] 
************************************************************* *

*changed: [20.152.30.10]*


*TASK: [Debug] 
***************************************************************** *

*ok: [20.152.30.10] => {*

*    "msg": "[]"*

*}*


*PLAY RECAP 
******************************************************************** *

*20.152.30.10               : ok=3    changed=1    unreachable=0   
 failed=0   *



What do i miss? Why I can not see all the echo commands that I wrote?

Thanks,
Doron

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a155fd7b-526b-40fa-844a-81b061023b51%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to