blob: 13f30a6f8d79b14bedd35eec85c08e9560bfc149 (
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
---
# TODO: allow for overriding default ports where possible
- name: Install OpenShift Node package
yum: pkg=openshift-node state=present
register: node_install_result
- name: Install openshift-sdn-ovs
yum: pkg=openshift-sdn-ovs state=present
register: sdn_install_result
when: openshift.common.use_openshift_sdn
- name: Reload systemd units
command: systemctl daemon-reload
when: (node_install_result | changed or (openshift.common.use_openshift_sdn
and sdn_install_result | changed))
- name: Set node OpenShift facts
openshift_facts:
role: "{{ item.role }}"
local_facts: "{{ item.local_facts }}"
with_items:
- role: common
local_facts:
hostname: "{{ openshift_hostname | default(none) }}"
public_hostname: "{{ openshift_public_hostname | default(none) }}"
deployment_type: "{{ openshift_deployment_type }}"
- role: node
local_facts:
resources_cpu: "{{ openshift_node_resources_cpu | default(none) }}"
resources_memory: "{{ openshift_node_resources_memory | default(none) }}"
pod_cidr: "{{ openshift_node_pod_cidr | default(none) }}"
labels: "{{ openshift_node_labels | default(none) }}"
annotations: "{{ openshift_node_annotations | default(none) }}"
registry_url: "{{ oreg_url | default(none) }}"
debug_level: "{{ openshift_node_debug_level | default(openshift.common.debug_level) }}"
portal_net: "{{ openshift_master_portal_net | default(None) }}"
# TODO: add the validate parameter when there is a validation command to run
- name: Create the Node config
template:
dest: "{{ openshift_node_config_file }}"
src: node.yaml.v1.j2
notify:
- restart openshift-node
- name: Configure OpenShift Node settings
lineinfile:
dest: /etc/sysconfig/openshift-node
regexp: "{{ item.regex }}"
line: "{{ item.line }}"
with_items:
- regex: '^OPTIONS='
line: "OPTIONS=--loglevel={{ openshift.node.debug_level }}"
- regex: '^CONFIG_FILE='
line: "CONFIG_FILE={{ openshift_node_config_file }}"
notify:
- restart openshift-node
- stat: path=/etc/sysconfig/docker
register: docker_check
# TODO: Enable secure registry when code available in origin
- name: Secure OpenShift Registry
lineinfile:
dest: /etc/sysconfig/docker
regexp: '^OPTIONS=.*'
line: "OPTIONS='--insecure-registry={{ openshift.node.portal_net }} --selinux-enabled'"
when: docker_check.stat.isreg
- name: Allow NFS access for VMs
seboolean: name=virt_use_nfs state=yes persistent=yes
- name: Start and enable openshift-node
service: name=openshift-node enabled=yes state=started
- name: Check scheduleable state
delegate_to: "{{ openshift_first_master }}"
command: >
{{ openshift.common.client_binary }} get node {{ openshift.common.hostname }}
register: ond_get_node
until: ond_get_node.rc == 0
retries: 10
delay: 5
- name: Handle unscheduleable node
delegate_to: "{{ openshift_first_master }}"
command: >
{{ openshift.common.admin_binary }} manage-node {{ openshift.common.hostname }} --schedulable=false
when: openshift_scheduleable is defined and openshift_scheduleable == False and "SchedulingDisabled" not in ond_get_node.stdout
- name: Handle scheduleable node
delegate_to: "{{ openshift_first_master }}"
command: >
{{ openshift.common.admin_binary }} manage-node {{ openshift.common.hostname }} --schedulable=true
when: (openshift_scheduleable is not defined or openshift_scheduleable == True) and "SchedulingDisabled" in ond_get_node.stdout
|