-
Notifications
You must be signed in to change notification settings - Fork 0
/
homework.yaml
215 lines (188 loc) · 6.31 KB
/
homework.yaml
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
---
- name: Prepare GUID environment variable across all hosts
hosts: all
tasks:
- name: All GUID env variable
shell: export GUID=`hostname | cut -d"." -f2`; echo "export GUID=$GUID" >> $HOME/.bashrc
- name: Script setup
hosts: localhost
tasks:
- name: "Script setup permision set.."
shell: chmod 755 ./scripts/script_setup.sh
- name: "Setting up the scripts.."
shell: ./scripts/script_setup.sh
- name: Verify Installation and Configuration of Docker
hosts: nodes
tasks:
- name: docker restart
shell: systemctl restart docker
- name: Install packages and config auth
hosts: localhost
tasks:
- name: required packages are present
yum:
name:
- atomic-openshift-clients
- atomic-openshift
state: present
- name: Generate Inventory Hosts File
hosts: localhost
tasks:
- name: Generate Inventory script
script: ./scripts/generate_inventory.sh
- name: Execute the openshift-ansible prerequisites
import_playbook: /usr/share/ansible/openshift-ansible/playbooks/prerequisites.yml
- name: Execute the openshift-ansible Deployer
import_playbook: /usr/share/ansible/openshift-ansible/playbooks/deploy_cluster.yml
# - name: Verify OpenShift Cluster
# hosts: masters[0]
# tasks:
# - name: copy the .kube directory from master1 to your bastion
# fetch:
# src: "/root/.kube/config"
# dest: "/root/.kube/config"
# flat: "yes"
- name: Verify OpenShift Cluster
hosts: masters[0]
tasks:
- name: tar .kube dir
archive:
path: /root/.kube
dest: /root/kube.tar.gz
- name: copy the .kube directory from master1 to your bastion
fetch:
src: /root/kube.tar.gz
dest: /root/
flat: yes
- name: Untar .kube
hosts: localhost
tasks:
- name: untar .kube
shell: tar -zxvf /root/kube.tar.gz -C /root
- name: Post installation configuration
hosts: localhost
tasks:
- name: make sure you are system:admin
shell: oc whoami | grep system:admin
- name: Create PVs for Users
hosts: nfs
tasks:
- name: "Create PV directories and add them to be exported"
script: ./scripts/create_pvs.sh
- name: Restarting NFS Server...
shell: systemctl restart nfs-server
tags:
- nfs
- name: Create 25 definitions files for PVs 5G size
hosts: localhost
tasks:
- name: "Creating the files.."
script: ./scripts/pvs_5Gsize.sh
- name: Create 25 definitions files for PVs 10G size
hosts: localhost
tasks:
- name: "Creating the files.."
script: ./scripts/pvs_10Gsize.sh
- name: Create all PVs from definitions files
hosts: localhost
tasks:
- name: "Creating PVs from the files.."
shell: "cat /root/pvs/* | oc create -f -"
- name: Fix NFS Persistent Volume Recycling
hosts: nodes
tasks:
- name: "pull the recycler image"
shell: docker pull registry.access.redhat.com/openshift3/ose-recycler:latest
- name: "tag the recycler image for specific version"
shell: docker tag registry.access.redhat.com/openshift3/ose-recycler:latest registry.access.redhat.com/openshift3/ose-recycler:v3.10.34
tags:
- fixnfs
- name: Setup CI/CD pipeline
hosts: localhost
tasks:
- name: Checkout CI/CD demo ..
git:
repo: 'https://github.com/injeti-dxc/repo.git'
dest: /root/openshift-cd-demo
- name: Permissions..
shell: sed -i -e 's/\r$//' /root/openshift-cd-demo/scripts/provision.sh
- name: Adding permissions
shell: chmod 755 /root/openshift-cd-demo/scripts/provision.sh
- name: permiissions..
shell: sed -i -e 's/\r$//' /root/openshift-cd-demo/cicd-template.yaml
- name: Adding rest of permissions
shell: chmod 755 /root/openshift-cd-demo/cicd-template.yaml
- name: Provision the demo environment..
shell: /root/openshift-cd-demo/scripts/provision.sh --user andrew deploy
tags:
- cicd
- name: Setup project request template
hosts: localhost
tasks:
- name: Create project request template in default project
shell: "oc create -f ./project-template.yml -n default || oc replace -f ./project-template.yml -n default"
tags:
- fixtemplate
- name: Update the master config file to use project request template
hosts: masters
tasks:
- name: Add the project request template to the master config"
lineinfile:
regexp: " projectRequestTemplate"
dest: "/etc/origin/master/master-config.yaml"
line: ' projectRequestTemplate: "default/project-request"'
state: present
- name: Restart master API service
shell: systemctl restart atomic-openshift-node
tags:
- fixtemplate
- name: Smoke Test
hosts: localhost
tasks:
- name: Create the smoke-test project
shell: oc new-project smoke-test
- name: Deploy the test app
shell: oc new-app --namespace smoke-test nodejs-mongo-persistent
tags:
- smoke-test
- name: Creation of projects for Alpha and Beta clients
hosts: localhost
tasks:
- name: Create alpha project
shell: oc new-project alpha
- name: Create beta project
shell: oc new-project beta
tags:
- create_projects
- name: Creation of users for Alpha and Beta clients
hosts: masters
tasks:
- name: Adding users for alpha and beta
script: ./scripts/add-users.sh
tags:
- create_users
#- name: Assigning labels to the users according to its group
#- name: Setup the environment for Alpha and Beta clients
- name: Kick off the pipeline
hosts: localhost
tasks:
- name: Wait for the demo environment to fully spin up
shell: sleep 300
- name: Kick off the pipeline
shell: "oc start-build tasks-pipeline -n tasks-dev"
tags:
- cicd
- name: HPA configuration on production deployment of openshift-tasks
hosts: localhost
tasks:
- name: Wait for tasks pipeline to build
shell: sleep 600
- name: Configure autoscaling on openshift-tasks..
shell: oc autoscale dc tasks --max 5 --min 2 --cpu-percent 80 -n tasks-prod
tags:
- hpa
- name: Multitenancy Test
hosts: localhost
tasks:
- name: Multitenancy Test
script: ./scripts/multitenancy.sh