Hello,
I don’t understand where I am doing wrong in this simple tasks:
-
name: Search for bin directory
stat:
path: /{{ Directoryname }}/{{ item }}/bin
register: previous
with_items: “{{ shr4you_inst.stdout_lines }}”
when: shr4you_inst|success -
debug: msg=“previous {{previous}}”
-
name: stop karaf
shell: chdir={{ previous.stat.path }} ./stop
async: 5
poll: 5
ignore_errors: True
when: previous.stat.isdir
The last When: condition is ALWAYS running with this error: “The error was: unable to evaluate conditional: previous.stat.isdir”
Here is the logfile:
TASK [4YOU : Search for bin directory] **************************************
ok: [integuno] => (item=SHR_4YOU-hra-1.1.0-SNAPSHOT)
TASK [4YOU : debug] ************************************************************
ok: [integuno] => {
“msg”: “previous {‘msg’: u’All items completed’, ‘changed’: False, ‘results’: [{u’stat’: {u’uid’: 54322, u’exists’: True, u’woth’: False, u’mtime’: 1472557536, u’inode’: 21695026, u’isgid’: False, u’size’: 4096, u’wgrp’: False, u’isuid’: False, u’isreg’: False, u’pw_name’: u’integuno’, u’gid’: 54323, u’ischr’: False, u’wusr’: True, u’xoth’: True, u’rusr’: True, u’nlink’: 2, u’issock’: False, u’rgrp’: True, u’gr_name’: u’hr’, u’path’: u’/integuno/DV70_EX/SHR_4YOU-hra-1.1.0-SNAPSHOT/bin’, u’xusr’: True, u’atime’: 1472557622, u’isdir’: True, u’ctime’: 1472634055, u’isblk’: False, u’xgrp’: True, u’dev’: 64768, u’roth’: True, u’isfifo’: False, u’mode’: u’0755’, u’islnk’: False}, u’changed’: False, ‘_ansible_no_log’: False, ‘_ansible_item_result’: True, ‘item’: u’SHR_4YOU-hra-1.1.0-SNAPSHOT’, ‘invocation’: {‘module_name’: u’stat’, u’module_args’: {u’checksum_algorithm’: u’sha1’, u’mime’: False, u’get_checksum’: True, u’follow’: False, u’path’: u’/integuno/DV70_EX/SHR_4YOU-hra-1.1.0-SNAPSHOT/bin’, u’get_md5’: True}}}]}”
}
TASK [4YOU : stop karaf] *******************************************************
fatal: [integuno]: FAILED! => {“failed”: true, “msg”: “The conditional check ‘previous.stat.isdir’ failed. The error was: unable to evaluate conditional: previous.stat.isdir\n\nThe error appears to have been in ‘/home/fvaltat/4YOU/roles/4YOU/tasks/sauvegarde.yml’: line 18, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: stop karaf\n ^ here\n”}
…ignoring
Thanks for your help,
Regards