summaryrefslogtreecommitdiffstats
path: root/roles/openshift_provisioners/tasks/install_provisioners.yaml
blob: 1be4984894beb61a165f708d8c903486a54bfbb0 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
- name: Check that EFS File System ID is set
  fail: msg='the openshift_provisioners_efs_fsid variable is required'
  when: (openshift_provisioners_efs | bool) and openshift_provisioners_efs_fsid is not defined

- name: Check that EFS region is set
  fail: msg='the openshift_provisioners_efs_region variable is required'
  when: (openshift_provisioners_efs | bool) and openshift_provisioners_efs_region is not defined

- name: Check that EFS AWS access key id is set
  fail: msg='the openshift_provisioners_efs_aws_access_key_id variable is required'
  when: (openshift_provisioners_efs | bool) and openshift_provisioners_efs_aws_access_key_id is not defined

- name: Check that EFS AWS secret access key is set
  fail: msg='the openshift_provisioners_efs_aws_secret_access_key variable is required'
  when: (openshift_provisioners_efs | bool) and openshift_provisioners_efs_aws_secret_access_key is not defined

- name: Ensure that provisioners have nodes to run on
  fail:
    msg: |-
      No schedulable nodes found matching node selector for Prometheus - '{{ openshift_provisioners_efs_nodeselector }}'
  when:
  - openshift_schedulable_node_labels | lib_utils_oo_has_no_matching_selector(openshift_provisioners_efs_nodeselector)

- name: Install support
  include_tasks: install_support.yaml

- name: Install EFS
  include_tasks: install_efs.yaml
  when: openshift_provisioners_efs | bool

- find: paths={{ mktemp.stdout }}/templates patterns=*.yaml
  register: object_def_files
  changed_when: no

- slurp: src={{item}}
  register: object_defs
  with_items: "{{object_def_files.files | map(attribute='path') | list | sort}}"
  changed_when: no

- name: Create objects
  include_tasks: oc_apply.yaml
  vars:
  - kubeconfig: "{{ mktemp.stdout }}/admin.kubeconfig"
  - namespace: "{{ openshift_provisioners_project }}"
  - file_name: "{{ file.source }}"
  - file_content: "{{ file.content | b64decode | from_yaml }}"
  with_items: "{{ object_defs.results }}"
  loop_control:
    loop_var: file
  when: not ansible_check_mode

- name: Printing out objects to create
  debug: msg={{file.content | b64decode }}
  with_items: "{{ object_defs.results }}"
  loop_control:
    loop_var: file
  when: ansible_check_mode

- name: Scaling up cluster
  include_tasks: start_cluster.yaml
  when: start_cluster | default(true) | bool