---

- name: Check MD5 sum for installed packages
  script: files/verify_md5_packages_ubuntu.sh
  environment:
    APT_CONF: "{{ apt_conf }}"
    UNKNOWN_CUSTOM_PKGS: "{{ unknown_custom_pkgs }}"
    UNKNOWN_UPGRADABLE_PKGS: "{{ unknown_upgradable_pkgs }}"
  ignore_errors: true
  register: verify_result

- name: Show results of MD5 sum verification
  debug:
    msg: "{{ verify_result.stdout_lines }}"
  when: verify_result.stdout != ""

- name: Fail if MD5 verification failed
  fail:
    msg: "[ERROR] MD5 sum Verificationof FAILED"
  when: verify_result.rc != 0

- name: Remove messages and leave only packages
  shell: echo "{{ verify_result.stdout }}" | grep -v '^\['; exit 0
  register: md5_verify_result

---

- name: Check MD5 sum for installed packages
  script: files/verify_md5_packages_ubuntu.sh
  environment:
    APT_CONF: "{{ apt_conf }}"
    UNKNOWN_CUSTOM_PKGS: "{{ unknown_custom_pkgs }}"
    UNKNOWN_UPGRADABLE_PKGS: "{{ unknown_upgradable_pkgs }}"
  ignore_errors: true
  register: verify_result

- name: Get list of upgrdable packages
  shell:  apt-get -c "{{ apt_conf }}" --just-print upgrade | egrep -v "Conf|Inst" | egrep "^  |graded|required"; exit 0
  register: upgradable_pkgs

- name: Show upgradable packages
  debug:
    msg: "{{ upgradable_pkgs.stdout_lines }}"
  when: upgradable_pkgs.stdout != ""

- name: Show results of MD5 sum verification
  debug:
    msg: "{{ verify_result.stdout_lines }}"
  when: verify_result.stdout != ""

- name: Fail if MD5 verification failed
  fail:
    msg: "[ERROR] MD5 sum Verificationof FAILED"
  when: verify_result.rc != 0

- name: Remove messages and leave only packages
  shell: echo "{{ verify_result.stdout }}" | grep -v '^\['; exit 0
  register: md5_verify_result

Add print of updatable packages
Add print of updatable packages
