Browse Source

Merge "Add install and deploy openshift roles."

changes/24/630224/1
Zuul 5 months ago
parent
commit
fba15d26a6

+ 1
- 0
roles/deploy-openshift/README.rst View File

@@ -0,0 +1 @@
1
+Deploy openshift using oc cluster up.

+ 24
- 0
roles/deploy-openshift/tasks/main.yaml View File

@@ -0,0 +1,24 @@
1
+---
2
+- name: Deploy local openshift cluster
3
+  command: "oc cluster up --insecure-skip-tls-verify=true --public-hostname={{ ansible_hostname }}"
4
+  become: yes
5
+
6
+- name: Create zuul user .kube directory
7
+  file:
8
+    path: "{{ ansible_user_dir }}/.kube"
9
+    state: directory
10
+
11
+- name: Setup zuul user kube config
12
+  copy:
13
+    src: /root/.kube/config
14
+    dest: "{{ ansible_env.HOME }}/.kube/config"
15
+    owner: "{{ ansible_env.USER }}"
16
+    mode: 0600
17
+    remote_src: yes
18
+  become: yes
19
+
20
+- name: Login as system:admin
21
+  command: oc login -u system:admin
22
+
23
+- name: Who am i
24
+  command: oc whoami -c

+ 16
- 0
roles/install-openshift/README.rst View File

@@ -0,0 +1,16 @@
1
+Setup openshift requirements and pull the container images.
2
+The deploy-openshift role can be used to start the services.
3
+
4
+This role only works on CentOS.
5
+
6
+**Role Variables**
7
+
8
+.. zuul:rolevar:: origin_repo
9
+   :default: centos-release-openshift-origin39
10
+
11
+   The origin repository.
12
+
13
+.. zuul:rolevar:: origin_version
14
+   :default: v3.9.0
15
+
16
+   The origin version.

+ 2
- 0
roles/install-openshift/defaults/main.yaml View File

@@ -0,0 +1,2 @@
1
+origin_repo: centos-release-openshift-origin39
2
+origin_version: v3.9.0

+ 44
- 0
roles/install-openshift/tasks/main.yaml View File

@@ -0,0 +1,44 @@
1
+- name: Install origin repository
2
+  yum:
3
+    name: "{{ origin_repo }}"
4
+  become: yes
5
+
6
+- name: Install requirements
7
+  yum:
8
+    name: "{{ item }}"
9
+  with_items:
10
+    - origin
11
+    - docker
12
+  become: yes
13
+
14
+- name: Fix docker start options
15
+  lineinfile:
16
+    dest: /etc/sysconfig/docker
17
+    regexp: "^OPTIONS="
18
+    line: "OPTIONS='--selinux-enabled --log-driver=journald --signature-verification=false --insecure-registry 172.30.0.0/16'"
19
+  become: yes
20
+
21
+# See: https://github.com/openshift/origin/issues/15038
22
+- name: Fix rhel secret issue
23
+  file:
24
+    path: /usr/share/rhel/secrets
25
+    state: absent
26
+  become: yes
27
+
28
+- name: Start docker service
29
+  service:
30
+    name: docker
31
+    state: started
32
+  become: yes
33
+
34
+- name: Pull origin images
35
+  command: "docker pull docker.io/openshift/{{ item }}:{{ origin_version }}"
36
+  with_items:
37
+    - origin-web-console
38
+    - origin-docker-registry
39
+    - origin-haproxy-router
40
+    - origin-deployer
41
+    - origin-sti-builder
42
+    - origin-pod
43
+    - origin
44
+  become: yes

Loading…
Cancel
Save