summaryrefslogtreecommitdiffstats
path: root/roles/openshift_excluder/tasks/main.yml
blob: f0e87ba25ce2c3c36256dc474866e5096176d1f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
- name: Detecting Atomic Host Operating System
  stat:
    path: /run/ostree-booted
  register: ostree_booted

- block:

  - name: Debug r_openshift_excluder_enable_docker_excluder
    debug:
      var: r_openshift_excluder_enable_docker_excluder

  - name: Debug r_openshift_excluder_enable_openshift_excluder
    debug:
      var: r_openshift_excluder_enable_openshift_excluder

  - name: Fail if invalid openshift_excluder_action provided
    fail:
      msg: "openshift_excluder role can only be called with 'enable' or 'disable'"
    when: r_openshift_excluder_action not in ['enable', 'disable']

  - name: Fail if r_openshift_excluder_upgrade_target is not defined
    fail:
      msg: "r_openshift_excluder_upgrade_target must be provided when using this role for upgrades"
    when:
    - r_openshift_excluder_verify_upgrade | bool
    - r_openshift_excluder_upgrade_target is not defined

  - name: Include main action task file
    include_tasks: "{{ r_openshift_excluder_action }}.yml"

  when:
  - not ostree_booted.stat.exists | bool