---
# patching.yml
# 
# Variables:
# - hosts: what hosts in the inventory to use
# - threads: how many to check in parallel
- hosts: "{{ hosts | default('managed') }}"
  order: sorted
  serial: "{{ threads | default('4') }}"
  ignore_unreachable: true
  vars: 
    ansible_become: no
  tasks:

    - name: Check updates
      yum: 
        list=updates
        update_cache=true
      ignore_errors: true
      register: yumupdates

    - name: Patching succeeded
      ignore_errors: true
      assert: 
        that: 
          - yumupdates.results|length == 0
          - df_output.stdout is search("rhel-7-server-rpms-nist")
