status.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. ---
  2. - name: Determine if excluder packages are installed
  3. rpm_q:
  4. name: "{{ openshift.common.service_type }}-excluder"
  5. state: present
  6. register: openshift_excluder_installed
  7. failed_when: false
  8. # docker excluder needs to be enable by default
  9. - name: Determine if docker packages are installed
  10. rpm_q:
  11. name: "{{ openshift.common.service_type }}-docker-excluder"
  12. state: present
  13. register: docker_excluder_installed
  14. failed_when: false
  15. # The excluder status function returns 0 when everything is excluded
  16. # and 1 if any packages are missing from the exclusions list and outputs a warning to stderr
  17. # # atomic-openshift-excluder status ; echo $?
  18. # exclude -- All packages excluded
  19. # 0
  20. # # atomic-openshift-excluder unexclude
  21. # # atomic-openshift-excluder status ; echo $?
  22. # unexclude -- At least one package not excluded
  23. # 1
  24. - block:
  25. - include: init.yml
  26. - block:
  27. - name: Record openshift excluder status
  28. command: "{{ openshift.common.service_type }}-excluder status"
  29. register: excluder_status
  30. failed_when: false
  31. # Even though the openshift excluder is enabled
  32. # if the status is non-zero, disabled the excluder
  33. - name: Override openshift excluder enablement if the status is non-zero
  34. set_fact:
  35. disable_openshift_excluder_override: true
  36. when:
  37. - "{{ excluder_status.rc | default(0) != 0 }}"
  38. - debug:
  39. msg: "Disabling openshift excluder"
  40. when:
  41. - "{{ excluder_status.rc | default(0) != 0 }}"
  42. when:
  43. - "{{ openshift_excluder_installed.installed_versions | default([]) | length > 0 }}"
  44. - "{{ openshift_excluder_on }}"
  45. - block:
  46. - name: Record docker excluder status
  47. command: "{{ openshift.common.service_type }}-docker-excluder status"
  48. register: docker_excluder_status
  49. failed_when: false
  50. # If the docker excluder is installed and the status is non-zero
  51. # always enable the docker excluder
  52. - name: Override docker excluder enablement if the status is non-zero
  53. set_fact:
  54. enable_docker_excluder_override: true
  55. when:
  56. - "{{ docker_excluder_status.rc | default(0) != 0 }}"
  57. - debug:
  58. msg: "Enabling docker excluder"
  59. when:
  60. - "{{ docker_excluder_status.rc | default(0) != 0 }}"
  61. # As the docker excluder status is not satisfied,
  62. # re-enable entire docker excluder again
  63. # At the same time keep the override set in a case other task would
  64. - name: Enable docker excluder
  65. command: "{{ openshift.common.service_type }}-docker-excluder exclude"
  66. # Run the docker excluder status even if the excluder is disabled.
  67. # In order to determine of the excluder needs to be enabled.
  68. when:
  69. - "{{ docker_excluder_installed.installed_versions | default([]) | length > 0 }}"
  70. - "{{ docker_excluder_on }}"
  71. when:
  72. - not openshift.common.is_containerized | bool