summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Cacqueray <tdecacqu@redhat.com>2018-10-08 08:43:45 +0000
committerTristan Cacqueray <tdecacqu@redhat.com>2018-12-03 11:44:48 +0000
commita007a9ae3f3a47ca5ae198ce02956fa53477637e (patch)
treec60bdabd898388a771d7a4c57cbffbdd1ccd2265
parent2ea7a1b6bdf69d5a79658aea04a1f6d596e95d0a (diff)
Add install and deploy openshift roles.
Notes
Notes (review): Code-Review+1: Artem Goncharov <artem.goncharov@gmail.com> Code-Review+2: James E. Blair <corvus@inaugust.com> Code-Review+2: Tobias Henkel <tobias.henkel@bmw.de> Workflow+1: Tobias Henkel <tobias.henkel@bmw.de> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Thu, 10 Jan 2019 16:00:35 +0000 Reviewed-on: https://review.openstack.org/608610 Project: openstack-infra/zuul-jobs Branch: refs/heads/master
-rw-r--r--roles/deploy-openshift/README.rst1
-rw-r--r--roles/deploy-openshift/tasks/main.yaml24
-rw-r--r--roles/install-openshift/README.rst16
-rw-r--r--roles/install-openshift/defaults/main.yaml2
-rw-r--r--roles/install-openshift/tasks/main.yaml44
5 files changed, 87 insertions, 0 deletions
diff --git a/roles/deploy-openshift/README.rst b/roles/deploy-openshift/README.rst
new file mode 100644
index 0000000..bb1f498
--- /dev/null
+++ b/roles/deploy-openshift/README.rst
@@ -0,0 +1 @@
Deploy openshift using oc cluster up.
diff --git a/roles/deploy-openshift/tasks/main.yaml b/roles/deploy-openshift/tasks/main.yaml
new file mode 100644
index 0000000..aa41364
--- /dev/null
+++ b/roles/deploy-openshift/tasks/main.yaml
@@ -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
diff --git a/roles/install-openshift/README.rst b/roles/install-openshift/README.rst
new file mode 100644
index 0000000..758245c
--- /dev/null
+++ b/roles/install-openshift/README.rst
@@ -0,0 +1,16 @@
1Setup openshift requirements and pull the container images.
2The deploy-openshift role can be used to start the services.
3
4This 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.
diff --git a/roles/install-openshift/defaults/main.yaml b/roles/install-openshift/defaults/main.yaml
new file mode 100644
index 0000000..6f77c75
--- /dev/null
+++ b/roles/install-openshift/defaults/main.yaml
@@ -0,0 +1,2 @@
1origin_repo: centos-release-openshift-origin39
2origin_version: v3.9.0
diff --git a/roles/install-openshift/tasks/main.yaml b/roles/install-openshift/tasks/main.yaml
new file mode 100644
index 0000000..3b5497d
--- /dev/null
+++ b/roles/install-openshift/tasks/main.yaml
@@ -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