commit | author | age
|
8412e9
|
1 |
--- |
JMP |
2 |
- name: define ocp_project |
|
3 |
set_fact: |
|
4 |
ocp_project: "parksmap-{{guid}}" |
|
5 |
ocp_project_completed: "parksmap-{{guid}}-completed" |
|
6 |
|
|
7 |
# Templates come from here: https://raw.githubusercontent.com/jorgemoralespou/ose-sample-apps-layouts |
|
8 |
|
|
9 |
- name: Create project for completed parksmap example |
|
10 |
shell: | |
|
11 |
oc new-project {{ocp_project_completed}} \ |
|
12 |
--display-name="Parksmap (completed)" \ |
|
13 |
--description="Project with the Parksmap demo completed (and guides)" |
|
14 |
ignore_errors: true |
|
15 |
|
|
16 |
- name: Deploy Parksmap |
|
17 |
shell: "oc apply -f /tmp/{{guid}}/workshop-parksmap.yaml -n {{ocp_project_completed}}" |
|
18 |
|
|
19 |
- name: Deploy Nationalparks |
|
20 |
shell: "oc apply -f /tmp/{{guid}}/workshop-nationalparks.yaml -n {{ocp_project_completed}}" |
|
21 |
|
|
22 |
- name: Deploy MLBParks |
|
23 |
shell: "oc apply -f /tmp/{{guid}}/workshop-mlbparks.yaml -n {{ocp_project_completed}}" |
|
24 |
|
|
25 |
- name: Add the template guide |
|
26 |
shell: "oc apply -f /tmp/{{guid}}/workshopper-template.yaml -n {{ocp_project_completed}}" |
|
27 |
|
|
28 |
- name: Deploy the guide to follow |
|
29 |
shell: | |
223042
|
30 |
oc new-app starter-guides \ |
8412e9
|
31 |
-p CONSOLE_ADDRESS={{ocp_master}} \ |
JMP |
32 |
-p ROUTER_ADDRESS={{ocp_apps_domain}} \ |
223042
|
33 |
-p USER_PROJECT={{ocp_project}} \ |
JM |
34 |
-p INFRA_PROJECT={{ocp_project_completed}} \ |
8412e9
|
35 |
-n "{{ocp_project_completed}}" |
JMP |
36 |
|
|
37 |
- name: Print where's the guide |
|
38 |
debug: |
|
39 |
msg: "Guide has been installed in http://guides-{{ocp_project_completed}}.{{ocp_apps_domain}}" |
|
40 |
|
223042
|
41 |
##### |
JM |
42 |
# Gogs |
|
43 |
##### |
|
44 |
- set_fact: |
|
45 |
gogs_hostname: "gogs-{{ ocp_project_completed }}.{{ ocp_apps_domain }}" |
|
46 |
|
|
47 |
- import_role: |
27c2f1
|
48 |
name: siamaksade.openshift_gogs |
223042
|
49 |
vars: |
JM |
50 |
project_name: "{{ ocp_project_completed }}" |
|
51 |
gogs_route: "{{ gogs_hostname }}" |
|
52 |
gogs_user: "developer" |
|
53 |
gogs_password: "developer" |
|
54 |
clean_deploy: false |
|
55 |
# Clone required project in Gogs |
|
56 |
# |
|
57 |
- name: "Create local repository to push to git (Java version)" |
|
58 |
command: git clone https://github.com/openshift-roadshow/nationalparks.git |
|
59 |
args: |
|
60 |
chdir: "/tmp/{{guid}}" |
|
61 |
|
|
62 |
- name: Check if repository nationalparks exists in git for user "developer" |
|
63 |
uri: |
|
64 |
url: http://{{ gogs_hostname }}/api/v1/repos/developer/nationalparks |
|
65 |
user: "developer" |
|
66 |
password: "developer" |
|
67 |
force_basic_auth: true |
|
68 |
status_code: 200,404 |
|
69 |
register: repo_result |
|
70 |
|
|
71 |
- name: Create git repository nationalparks for user "developer" |
|
72 |
uri: |
|
73 |
url: http://{{ gogs_hostname }}/api/v1/user/repos |
|
74 |
method: POST |
|
75 |
body: '{"name": "nationalparks", "private": false}' |
|
76 |
body_format: json |
|
77 |
user: "developer" |
|
78 |
password: "developer" |
|
79 |
status_code: 200,201 |
|
80 |
force_basic_auth: true |
|
81 |
when: repo_result.status != 200 |
|
82 |
|
|
83 |
- name: Push nationalparks to git repository in Gogs for user "developer" |
|
84 |
shell: | |
|
85 |
git remote add developer http://developer:developer@{{ gogs_hostname }}/developer/nationalparks.git |
|
86 |
git config --local user.email "developer@example.com" |
|
87 |
git config --local user.name "developer" |
|
88 |
git push -f --all developer |
|
89 |
args: |
|
90 |
chdir: "/tmp/{{guid}}/nationalparks" |
|
91 |
when: repo_result.status != 200 |
|
92 |
|
8412e9
|
93 |
- name: Annotate the completed project as requested by user |
JMP |
94 |
shell: "oc annotate namespace {{ocp_project_completed}} openshift.io/requester={{ocp_username}} --overwrite" |
|
95 |
|
|
96 |
- name: Give user access to the completed project |
|
97 |
shell: "oc policy add-role-to-user admin {{ocp_username}} -n {{ocp_project_completed}}" |
|
98 |
|
|
99 |
# |
|
100 |
# Now create an empty project for the user to execute the demo themselves |
|
101 |
# |
|
102 |
|
|
103 |
- name: Create project for empty parksmap |
|
104 |
shell: | |
|
105 |
oc new-project {{ocp_project}} \ |
|
106 |
--display-name="Parksmap" \ |
|
107 |
--description="Project to exercise the Parksmap demo" |
|
108 |
ignore_errors: true |
|
109 |
|
|
110 |
- name: Annotate the empty project as requested by user |
|
111 |
shell: "oc annotate namespace {{ocp_project}} openshift.io/requester={{ocp_username}} --overwrite" |
|
112 |
|
|
113 |
- name: Give user access to the empty project |
|
114 |
shell: "oc policy add-role-to-user admin {{ocp_username}} -n {{ocp_project}}" |
|
115 |
|
|
116 |
- name: workload Tasks Complete |
|
117 |
debug: |
|
118 |
msg: workload Tasks Complete |