summaryrefslogtreecommitdiffstats
path: root/roles/openshift_master/tasks/main.yml
blob: aa615df3970ffaec7134dd5d6e5c57b92310c6f1 (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
---
# TODO: actually have api_port, api_use_ssl, console_port, console_use_ssl,
# etcd_use_ssl actually change the master config.

- name: Set master OpenShift facts
  openshift_facts:
    role: 'master'
    local_facts:
      debug_level: "{{ openshift_master_debug_level | default(openshift.common.debug_level) }}"
      api_port: "{{ openshift_master_api_port | default(None) }}"
      api_url: "{{ openshift_master_api_url | default(None) }}"
      api_use_ssl: "{{ openshift_master_api_use_ssl | default(None) }}"
      public_api_url: "{{ openshift_master_public_api_url | default(None) }}"
      console_port: "{{ openshift_master_console_port | default(None) }}"
      console_url: "{{ openshift_master_console_url | default(None) }}"
      console_use_ssl: "{{ openshift_master_console_use_ssl | default(None) }}"
      public_console_url: "{{ openshift_master_public_console_url | default(None) }}"
      etcd_use_ssl: "{{ openshift_master_etcd_use_ssl | default(None) }}"

- name: Install OpenShift Master package
  yum: pkg=openshift-master state=installed

# TODO: We should pre-generate the master config and point to the generated
# config rather than setting command line flags here
- name: Configure OpenShift settings
  lineinfile:
    dest: /etc/sysconfig/openshift-master
    regexp: '^OPTIONS='
    line: "OPTIONS=\"--master={{ openshift.common.hostname }} --public-master={{ openshift.common.public_hostname }} {% if openshift_node_ips %} --nodes={{ openshift_node_ips | join(',') }} {% endif %} --loglevel={{ openshift.master.debug_level }}\""
  notify:
  - restart openshift-master

# TODO: should this be populated by a fact based on the deployment type
# (origin, online, enterprise)?
- 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: Start and enable openshift-master
  service: name=openshift-master enabled=yes state=started

- name: Create .kube directory
  file:
    path: /root/.kube
    state: directory
    mode: 0700

# TODO: Update this file if the contents of the source file are not present in
# the dest file, will need to make sure to ignore things that could be added
- name: Configure root user kubeconfig
  command: cp /var/lib/openshift/openshift.local.certificates/openshift-client/.kubeconfig /root/.kube/.kubeconfig
  args:
    creates: /root/.kube/.kubeconfig