On 10. aug. 2016 16:57, Enjoy The Silence wrote:
I've made some changes in the script. I still need some help with the
script.

Here is the updated code.
  - name: Get Hitachi Devices device details
    shell: lsscsi | grep HITACHI | awk '{print $6}'
    register: hitachiDevice


  - name: Check if the volume is partitioned
    shell: ls -l "{{ hitachiDevice.stdout }}"* | wc -l
    failed_when: hitachiDevice.rc != 1



Here is the error:
FAILED! => {"changed": true, "cmd": "ls -l \"/dev/sdg\"* | wc -l", "delta":
"0:00:00.010330", "end": "2016-08-10 17:35:34.819617", "failed": true,
"failed_when_result": true, "rc": 0, "start": "2016-08-10 17:35:34.809287",
"stderr": "", "stdout": "1", "stdout_lines": ["1"], "warnings": []}

As the message say "failed_when_result": true, so you failed_when triggered. rc = 0 is OK and rc > 0 is an ERROR.

So for you failed_when to make sense it should be != 0.

I also recommend moving the failed_when to the "Get Hitachi Devices device details" task, since it is that task that fails it will be more clear and you debugging would be easier.

--
Kai Stian Olstad

--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/eeb7721c-b955-72dc-e52a-12b6e84ee406%40olstad.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to