hi all,
I'm trying run the below playbook and facing an exception

ansbile version : 1.4.3
os : debian wheezy

playbook:
===================================

 ---
 - hosts: db
   gather_facts: false
   tasks:
       - name: get free mem                                                 
                                                                            
                                                           
         shell: free | grep Mem | awk '{print $4}'
         register: free_mem
 
       - name: get buffer 
         shell: free | grep Mem| awk '{print $6}'
         register: buffer 
 
       - name: get cache
         shell: free | grep Mem | awk '{print $7}'
         register: cache
     
       - name: get swap used 
         shell: free | grep Swap| awk '{print $3}'
         register: swap_used
 
       - name: swap on swap off 
         shell: echo "yeah we can sawpoff and on"
         when: free_mem + buffer + cache > swap_used 
         
=========================================

Exception:
=========================================
TASK: [swap on swap off] 
****************************************************** 
fatal: [jar.pickle.io] => Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py", 
line 394, in _executor
    exec_rc = self._executor_internal(host, new_stdin)
  File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py", 
line 485, in _executor_internal
    return self._executor_internal_inner(host, self.module_name, 
self.module_args, inject, port, complex_args=complex_args)
  File "/usr/local/lib/python2.7/dist-packages/ansible/runner/__init__.py", 
line 572, in _executor_internal_inner
    if not utils.check_conditional(cond, self.basedir, inject, 
fail_on_undefined=self.error_on_undefined_vars):
  File "/usr/local/lib/python2.7/dist-packages/ansible/utils/__init__.py", 
line 186, in check_conditional
    conditional = template.template(basedir, presented, inject)
  File "/usr/local/lib/python2.7/dist-packages/ansible/utils/template.py", 
line 319, in template
    varname = template_from_string(basedir, varname, vars, 
fail_on_undefined)
  File "/usr/local/lib/python2.7/dist-packages/ansible/utils/template.py", 
line 543, in template_from_string
    return res
UnboundLocalError: local variable 'res' referenced before assignment


FATAL: all hosts have already failed -- aborting
====================================================================

Regards
Shiva

-- 
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].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to