blob: ac96e2b48c664812f53774c93d2348d1ddd2d361 (
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
|
---
# 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_path: "{{ openshift_master_console_path | 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_port: "{{ openshift_master_etcd_port | default(None) }}"
etcd_use_ssl: "{{ openshift_master_etcd_use_ssl | default(None) }}"
portal_net: "{{ openshift_master_portal_net | default(None) }}"
# TODO: These values need to be configurable
- name: Set dns OpenShift facts
openshift_facts:
role: 'dns'
local_facts:
ip: "{{ openshift.common.ip }}"
domain: local
- name: Install OpenShift Master package
yum: pkg=openshift-master state=installed
register: install_result
- name: Reload systemd units
command: systemctl daemon-reload
when: install_result | changed
- name: Create certificate parent directory if it doesn't exist
file:
path: "{{ openshift_cert_parent_dir }}"
state: directory
- name: Create config parent directory if it doesn't exist
file:
path: "{{ openshift_master_config | dirname }}"
state: directory
# TODO: should probably use a template lookup for this
# TODO: should allow for setting --etcd, --kubernetes options
# TODO: recreate config if values change
- name: Use enterprise default for oreg_url if not set
set_fact:
oreg_url: "openshift3_beta/ose-${component}:${version}"
when: openshift.common.deployment_type == 'enterprise' and oreg_url is not defined
- name: Use online default for oreg_url if not set
set_fact:
oreg_url: "docker-registry.ops.rhcloud.com/openshift3_beta/ose-${component}:${version}"
when: openshift.common.deployment_type == 'online' and oreg_url is not defined
- name: Create master config
command: >
/usr/bin/openshift start master --write-config
--config={{ openshift_master_config }}
--portal-net={{ openshift.master.portal_net }}
--master={{ openshift.master.api_url }}
--public-master={{ openshift.master.public_api_url }}
--listen={{ 'https' if openshift.master.api_use_ssl else 'http' }}://0.0.0.0:{{ openshift.master.api_port }}
{{ ('--images=' ~ oreg_url) if (oreg_url | default('', true) != '') else '' }}
{{ ('--nodes=' ~ openshift_node_ips | join(',')) if (openshift_node_ips | default('', true) != '') else '' }}
args:
chdir: "{{ openshift_cert_parent_dir }}"
creates: "{{ openshift_master_config }}"
- name: Configure OpenShift settings
lineinfile:
dest: /etc/sysconfig/openshift-master
regexp: '^OPTIONS='
line: "OPTIONS=\"--config={{ openshift_master_config }} --loglevel={{ openshift.master.debug_level }}\""
notify:
- restart openshift-master
- name: Start and enable openshift-master
service: name=openshift-master enabled=yes state=started
- name: Create the OpenShift client config dir(s)
file:
path: "~{{ item }}/.config/openshift"
state: directory
mode: 0700
owner: "{{ item }}"
group: "{{ item }}"
with_items:
- root
- "{{ ansible_ssh_user }}"
# 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: Create the OpenShift client config(s)
command: cp {{ openshift_cert_dir }}/openshift-client/.kubeconfig ~{{ item }}/.config/openshift/.config
args:
creates: ~{{ item }}/.config/openshift/.config
with_items:
- root
- "{{ ansible_ssh_user }}"
- name: Update the permissions on the OpenShift client config(s)
file:
path: "~{{ item }}/.config/openshift/.config"
state: file
mode: 0700
owner: "{{ item }}"
group: "{{ item }}"
with_items:
- root
- "{{ ansible_ssh_user }}"
|