summaryrefslogtreecommitdiffstats
path: root/roles/openshift_master/tasks/main.yml
blob: d5f4776dccc72287aac32f00d3be22bf8678facd (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
---
- name: Install OpenShift Master package
  yum: pkg=openshift-master state=installed

- name: Configure OpenShift settings
  lineinfile:
    dest: /etc/sysconfig/openshift-master
    regexp: '^OPTIONS='
    line: "OPTIONS=\"--public-master={{ openshift_hostname }} {% if
    openshift_node_ips %} --nodes={{ openshift_node_ips
              | join(',') }} {% endif %} --loglevel={{ openshift_master_debug_level }}\""
  notify:
  - restart openshift-master

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

- name: Set master OpenShift facts
  include: "{{ role_path | dirname }}/openshift_common/tasks/set_facts.yml"
  facts:
  - section: master
    option: debug_level
    value: "{{ openshift_master_debug_level }}"
  - section: master
    option: public_ip
    value: "{{ openshift_public_ip }}"
  - section: master
    option: externally_managed
    value: "{{ openshift_master_manage_service_externally }}"

# TODO: remove this when origin PR #1298 has landed in OSE
- name: Workaround for openshift-master taking longer than 90 seconds to issue sdNotify signal
  command: cp /usr/lib/systemd/system/openshift-master.service /etc/systemd/system/
  args:
    creates: /etc/systemd/system/openshift-master.service
- ini_file:
    dest: /etc/systemd/system/openshift-master.service
    option: TimeoutStartSec
    section: Service
    value: 300
    state: present
  register: result
- command: systemctl daemon-reload
  when: result | changed
# End of workaround pending PR #1298

- name: Start and enable openshift-master
  service: name=openshift-master enabled=yes state=started
  when: not openshift_master_manage_service_externally
  register: result

#TODO: remove this when origin PR #1204 has landed in OSE
- name: need to pause here, otherwise we attempt to copy certificates generated by the master before they are generated
  pause: seconds=30
  when: result | changed
# End of workaround pending PR #1204

- name: Disable openshift-master if openshift-master is managed externally
  service: name=openshift-master enabled=false
  when: openshift_master_manage_service_externally

# TODO: create an os_vars role that has generic env related config and move
# the root kubeconfig setting there, cannot use dependencies to force ordering
# with openshift_node and openshift_master because the way conditional
# dependencies work with current ansible would also exclude the
# openshift_common dependency.
- name: Create .kube directory
  file:
    path: /root/.kube
    state: directory
    mode: 0700
- name: Configure root user kubeconfig
  command: cp /var/lib/openshift/openshift.local.certificates/admin/.kubeconfig /root/.kube/.kubeconfig
  args:
    creates: /root/.kube/.kubeconfig