blob: ca7dfb8854887dee5631997e0ad7e27e8e05b216 (
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
63
64
65
66
67
68
69
70
71
72
|
---
- name: create the cluster-autoscaler serviceaccount
oc_serviceaccount:
name: "{{ openshift_cluster_autoscaler_serviceaccount }}"
namespace: "{{ openshift_cluster_autoscaler_namespace }}"
state: "{{ openshift_cluster_autoscaler_state }}"
- name: copy the cluster-autoscaler files
copy:
src: "{{ item }}"
dest: "{{ openshift_cluster_autoscaler_template_location }}/{{ item }}"
with_items:
- clusterrole.yml
- role.yml
when: openshift_cluster_autoscaler_state == 'present'
- name: "Ensure the cluster-autoscaler roles are {{ openshift_cluster_autoscaler_state }}"
oc_obj:
namespace: "{{ openshift_cluster_autoscaler_namespace }}"
state: "{{ openshift_cluster_autoscaler_state }}"
kind: "{{ item.type }}"
name: "{{ item.name }}"
delete_after: "{{ openshift_cluster_autoscaler_delete_config }}"
files:
- "{{ openshift_cluster_autoscaler_template_location }}/{{ item.fname }}"
with_items:
- fname: clusterrole.yml
type: clusterrole
name: "system:{{ openshift_cluster_autoscaler_name }}"
- fname: role.yml
type: role
name: "{{ openshift_cluster_autoscaler_name }}"
- include_tasks: aws.yml
when: openshift_cluster_autoscaler_cloud_provider == 'aws'
- name: create the policies
oc_adm_policy_user:
state: "{{ openshift_cluster_autoscaler_state }}"
user: "system:serviceaccount:openshift-infra:{{ openshift_cluster_autoscaler_serviceaccount }}"
namespace: "{{ openshift_cluster_autoscaler_namespace }}"
resource_kind: "{{ item.name }}"
resource_name: cluster-autoscaler
role_namespace: "{{ item.role_namespace | default(omit) }}"
with_items:
- name: cluster-role
- name: role
role_namespace: "{{ openshift_cluster_autoscaler_namespace }}"
- name: "grant cluster-reader to {{ openshift_cluster_autoscaler_serviceaccount }}"
oc_adm_policy_user:
state: "{{ openshift_cluster_autoscaler_state }}"
user: "system:serviceaccount:{{ openshift_cluster_autoscaler_namespace }}:{{ openshift_cluster_autoscaler_serviceaccount }}"
namespace: "{{ openshift_cluster_autoscaler_namespace }}"
resource_name: cluster-reader
resource_kind: cluster-role
- name: laydown the deployment file for cluster-autoscaler
template:
src: cluster-autoscaler.j2
dest: "{{ openshift_cluster_autoscaler_template_location }}/{{ openshift_cluster_autoscaler_template_name }}"
when: openshift_cluster_autoscaler_state == 'present'
- name: "Ensure the cluster-autoscaler is {{ openshift_cluster_autoscaler_state }}"
oc_obj:
namespace: "{{ openshift_cluster_autoscaler_namespace }}"
state: "{{ openshift_cluster_autoscaler_state }}"
kind: deployment
name: "{{ openshift_cluster_autoscaler_name }}"
delete_after: "{{ openshift_cluster_autoscaler_delete_config }}"
files:
- "{{ openshift_cluster_autoscaler_template_location }}/{{ openshift_cluster_autoscaler_template_name }}"
|