summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node/tasks/main.yml
blob: c039e3f05828d0b7ebad6f108106efd1689c3018 (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
---
- 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_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: Set OpenShift node facts
  include: "{{ role_path | dirname }}/openshift_common/tasks/set_facts.yml"
  facts:
  - section: node
    option: debug_level
    value: "{{ openshift_node_debug_level }}"
  - section: node
    option: public_ip
    value: "{{ openshift_public_ip }}"
  - section: node
    option: externally_managed
    value: "{{ openshift_node_manage_service_externally }}"

- name: Start and enable openshift-node
  service: name=openshift-node enabled=yes state=started
  when: not openshift_node_manage_service_externally

- name: Disable openshift-node if openshift-node is managed externally
  service: name=openshift-node enabled=false
  when: openshift_node_manage_service_externally