---
- when: r_openshift_excluder_verify_upgrade | bool
  block:
  - name: Include verify_upgrade.yml when upgrading
    import_tasks: verify_upgrade.yml

# unexclude the current openshift/origin-excluder if it is installed so it can be updated
- name: Disable excluders before the upgrade to remove older excluding expressions
  import_tasks: unexclude.yml
  vars:
    # before the docker excluder can be updated, it needs to be disabled
    # to remove older excluded packages that are no longer excluded
    unexclude_docker_excluder: "{{ r_openshift_excluder_enable_docker_excluder }}"
    unexclude_openshift_excluder: "{{ r_openshift_excluder_enable_openshift_excluder }}"

# Install any excluder that is enabled
- name: Include install.yml
  import_tasks: install.yml

# And finally adjust an excluder in order to update host components correctly. First
# exclude then unexclude
- name: Include exclude.yml
  import_tasks: exclude.yml
  vars:
    # Enable the docker excluder only if it is overridden
    # BZ #1430612: docker excluders should be enabled even during installation and upgrade
    exclude_docker_excluder: "{{ r_openshift_excluder_enable_docker_excluder }}"
    # excluder is to be disabled by default
    exclude_openshift_excluder: false

# All excluders that are to be disabled are disabled
- name: Include unexclude.yml
  import_tasks: unexclude.yml
  vars:
    # If the docker override  is not set, default to the generic behaviour
    # BZ #1430612: docker excluders should be enabled even during installation and upgrade
    unexclude_docker_excluder: false
    # disable openshift excluder is never overridden to be enabled
    # disable it if the docker excluder is enabled
    unexclude_openshift_excluder: "{{ r_openshift_excluder_enable_openshift_excluder }}"
