blob: f8f42b771a126c7568c2038d0ccf045b84b5851c (
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
|
---
- name: create the namespace
oc_project:
state: present
name: "{{ openshift_daemonset_config_namespace }}"
- name: add a sa
oc_serviceaccount:
name: "{{ openshift_daemonset_config_sa_name }}"
namespace: "{{ openshift_daemonset_config_namespace }}"
- name: add sa to privileged scc
oc_adm_policy_user:
namespace: "{{ openshift_daemonset_config_namespace }}"
resource_kind: scc
resource_name: privileged
state: present
user: "system:serviceaccount:{{ openshift_daemonset_config_namespace }}:{{ openshift_daemonset_config_sa_name }}"
- name: copy template to disk
template:
dest: "/tmp/{{ item.name }}"
src: "{{ item.name }}.j2"
with_items:
- name: daemonset.yml
- name: copy files to disk
copy:
src: "{{ item.key }}"
dest: "{{ item.value }}"
with_dict: "{{ openshift_daemonset_config_configmap_files }}"
- name: lay down secrets
oc_secret:
state: present
name: "{{ openshift_daemonset_config_secret_name }}"
namespace: "{{ openshift_daemonset_config_namespace }}"
delete_after: true
contents: "{{ openshift_daemonset_config_secrets }}"
when:
- openshift_daemonset_config_secrets != {}
register: secout
- name: create the configmap
oc_configmap:
state: present
name: "{{ openshift_daemonset_config_configmap_name }}"
namespace: "{{ openshift_daemonset_config_namespace }}"
from_literal: "{{ openshift_daemonset_config_configmap_literals }}"
from_file: "{{ openshift_daemonset_config_configmap_files }}"
register: cmout
- name: deploy daemonset
oc_obj:
state: present
namespace: "{{ openshift_daemonset_config_namespace }}" # openshift-node??
name: "{{ openshift_daemonset_config_daemonset_name }}"
kind: daemonset
files:
- /tmp/daemonset.yml
force: "{{ True if cmout.changed or secout.changed else False | bool }}"
|