---
- name: This playbook is for Testing Disk Space
  hosts: proxy
  become: yes
  become_method: sudo
  serial: 1
  any_errors_fatal: true
  ignore_errors: yes
  gather_facts: yes
  vars:
          ansible_paython_interpreter: /usr/bin/python
  tasks:

       - name: disk usage from command module
         shell: df -h / | tail -n 1 | awk '{ print $5 }'
         register: used_space

       - debug:
           var: used_space.stdout
         register: one

       - name: decision making weather to proceed with update the system or 
not
         fail: msg="{{ inventory_hostname }} have low disk space. Please 
Make some space then run the updates."
         when: used_space.stdout >= "70%"
         ignore_errors: no


       - name: update the system
         yum:
           name: "*"
           state: latest
           exclude: 'kernel*'
           update_cache: yes
           update_only: yes

         register: yum_update

       - debug:
           msg: "{{ yum_update }}"

******************************

In the example if disk space is used by 75% then task stops playing but in 
this case i want to set email notification send to me so how can i do that 
?? 

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/0f3253fb-90ff-4265-82cc-b85cc2b1c52dn%40googlegroups.com.

Reply via email to