summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node/tasks/main.yml
blob: 8cfef0e15631defd71c366a45ffc7c1417db4bfa (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
---
# TODO: allow for overriding default ports where possible
# TODO: trigger the external service when restart is needed
- name: Set node OpenShift facts
  openshift_facts:
    role: 'node'
    local_facts:
      debug_level: "{{ openshift_node_debug_level | default(openshift.common.debug_level) }}"

- name: Test if node certs and config exist
  stat: path={{ item }}
  failed_when: not result.stat.exists
  register: result
  with_items:
  - "{{ cert_path }}"
  - "{{ cert_path }}/cert.crt"
  - "{{ cert_path }}/key.key"
  - "{{ cert_path }}/.kubeconfig"
  - "{{ cert_path }}/server.crt"
  - "{{ cert_path }}/server.key"
  - "{{ cert_parent_path }}/ca/cert.crt"
  #- "{{ cert_path }}/node.yaml"

- name: Install OpenShift Node package
  yum: pkg=openshift-node state=installed

# --create-certs=false is a temporary workaround until
# https://github.com/openshift/origin/pull/1361 is merged upstream and it is
# the default for nodes
- name: Configure OpenShift Node settings
  lineinfile:
    dest: /etc/sysconfig/openshift-node
    regexp: '^OPTIONS='
    line: "OPTIONS=\"--hostname={{ openshift.common.hostname }} --loglevel={{ openshift.node.debug_level }} --create-certs=false\""
  notify:
  - restart openshift-node

- name: Set default registry url
  lineinfile:
    dest: /etc/sysconfig/openshift-node
    regexp: '^IMAGES='
    line: "IMAGES={{ openshift_registry_url }}"
  when: openshift_registry_url is defined
  notify:
  - restart openshift-node

- name: Start and enable openshift-node
  service: name=openshift-node enabled=yes state=started
  when: not openshift.common.use_openshift_sdn|bool

- name: Disable openshift-node if openshift-node is managed externally
  service: name=openshift-node enabled=false
  when: openshift.common.use_openshift_sdn|bool