Skip to content

Commit b26a406

Browse files
authored
remove duplicate code (#3494)
1 parent d3d05a7 commit b26a406

File tree

1 file changed

+3
-221
lines changed
  • ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/tasks

1 file changed

+3
-221
lines changed

ansible/playbooks/AdoptOpenJDK_Unix_Playbook/roles/DockerStatic/tasks/main.yml

Lines changed: 3 additions & 221 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
#################################################
3-
# Build basic test images for each distribution #
4-
#################################################
2+
##########################################
3+
# Config changes for Dockerhost machines #
4+
##########################################
55

66
- name: Enable ipv6 on Dockerhost
77
lineinfile:
@@ -13,224 +13,6 @@
1313
notify:
1414
- Restart docker service
1515

16-
- name: Send Dockerfiles to remote machine
17-
copy:
18-
src: Dockerfiles/
19-
dest: /tmp/Dockerfiles/
20-
21-
- name: Collate all Dockerfile names
22-
find:
23-
paths: "/tmp/Dockerfiles/"
24-
patterns: "Dockerfile.*"
25-
register: dockerfiles
26-
27-
# Defaulting to x64 in Dockerfiles means no need to special case that one
28-
# since API architecture = ansible_architecture everywhere else we use this
29-
- name: Translate architecture name in dockerfiles
30-
replace: dest={{ item.path }} regexp="arch=x64" replace="arch={{ ansible_architecture }}"
31-
with_items: "{{ dockerfiles.files }}"
32-
when: ansible_architecture != "x86_64"
33-
34-
- name: Set jenkins authorized_Key in dockerfiles
35-
replace: dest={{ item.path }} regexp="Jenkins_User_SSHKey" replace="{{ Jenkins_User_SSHKey }}"
36-
with_items: "{{ dockerfiles.files }}"
37-
38-
- name: Create docker images for each distribution for test
39-
command: docker build --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ item }} --memory=8G -f /tmp/Dockerfiles/Dockerfile.{{ item }} /tmp/Dockerfiles
40-
with_items:
41-
- u1604
42-
- u1804
43-
- u2004
44-
- u2104
45-
- f33
46-
- f34
47-
- f35
48-
- alp311
49-
- alp312
50-
- alp313
51-
- alp314
52-
- ubi8
53-
- deb11
54-
55-
##############################################################
56-
# Start the containers #
57-
# If startallcontainers is skipped, only start three of them #
58-
# ignore_errors simplest way to ignore if already started #
59-
# #
60-
# TODO: Check if started rather than ignore error? #
61-
# hard to 'docker_container_info depends on start time #
62-
# TODO: Use a calculated value instead of 2 core/6Gb #
63-
##############################################################
64-
65-
- name: Start Ubuntu 16.04 container if not already started
66-
community.docker.docker_container:
67-
name: U1604_2222
68-
image: aqa_u1604
69-
ports:
70-
- "2222:22"
71-
cpus: 2.0
72-
memory: 6G
73-
state: started # Make sure container is presented (if not exist then start it)
74-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
75-
detach: yes
76-
tags: startcontainers
77-
failed_when: false
78-
79-
- name: Start Ubuntu 18.04 container if not already started
80-
community.docker.docker_container:
81-
name: U1804_2223
82-
image: aqa_u1804
83-
ports:
84-
- "2223:22"
85-
cpus: 4.0
86-
memory: 6G
87-
state: started # Make sure container is presented (if not exist then start it)
88-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
89-
detach: yes
90-
tags: startcontainers, startallcontainers
91-
failed_when: false
92-
93-
- name: Start Ubuntu 20.04 container if not already started
94-
community.docker.docker_container:
95-
name: U2004_2224
96-
image: aqa_u2004
97-
ports:
98-
- "2224:22"
99-
cpus: 2.0
100-
memory: 6G
101-
state: started # Make sure container is presented (if not exist then start it)
102-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
103-
detach: yes
104-
tags: startcontainers
105-
failed_when: false
106-
107-
- name: Start Ubuntu 21.04 container if not already started
108-
community.docker.docker_container:
109-
name: U2104_2225
110-
image: aqa_aqa_u2104u2004
111-
ports:
112-
- "2225:22"
113-
cpus: 4.0
114-
memory: 6G
115-
state: started # Make sure container is presented (if not exist then start it)
116-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
117-
detach: yes
118-
tags: startcontainers, startallcontainers
119-
failed_when: false
120-
121-
- name: Start Ubuntu 22.04 container if not already started
122-
command: docker run --restart unless-stopped -p 2226:22 --cpus=4.0 --memory=6G --detach --name U2204_2226 aqa_u2204
123-
tags: startcontainers, startallcontainers
124-
failed_when: false
125-
126-
- name: Start fedora 33 container if not already started
127-
community.docker.docker_container:
128-
name: f33.2227
129-
image: aqa_f33
130-
ports:
131-
- "2227:22"
132-
cpus: 2.0
133-
memory: 6G
134-
state: started # Make sure container is presented (if not exist then start it)
135-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
136-
detach: yes
137-
tags: startcontainers
138-
failed_when: false
139-
140-
- name: Start fedora 34 container if not already started
141-
community.docker.docker_container:
142-
name: f34.2232
143-
image: aqa_f34
144-
ports:
145-
- "2232:22"
146-
cpus: 2.0
147-
memory: 6G
148-
state: started # Make sure container is presented (if not exist then start it)
149-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
150-
detach: yes
151-
tags: startcontainers
152-
failed_when: false
153-
154-
- name: Start fedora 35 container if not already started
155-
community.docker.docker_container:
156-
name: f35.2233
157-
image: aqa_f35
158-
ports:
159-
- "2233:22"
160-
cpus: 2.0
161-
memory: 6G
162-
state: started # Make sure container is presented (if not exist then start it)
163-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
164-
detach: yes
165-
tags: startcontainers
166-
failed_when: false
167-
168-
- name: Start Alpine 3.11 container if not already started
169-
community.docker.docker_container:
170-
name: alp311.2228
171-
image: aqa_alp311
172-
ports:
173-
- "2228:22"
174-
cpus: 2.0
175-
memory: 6G
176-
state: started # Make sure container is presented (if not exist then start it)
177-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
178-
detach: yes
179-
tags: startcontainers, startallcontainers
180-
failed_when: false
181-
182-
- name: Start Alpine 3.12 container if not already started
183-
community.docker.docker_container:
184-
name: alp312.2229
185-
image: aqa_alp312
186-
ports:
187-
- "2229:22"
188-
cpus: 2.0
189-
memory: 6G
190-
state: started # Make sure container is presented (if not exist then start it)
191-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
192-
detach: yes
193-
tags: startcontainers
194-
failed_when: false
195-
196-
- name: Start Alpine 3.13 container if not already started
197-
community.docker.docker_container:
198-
name: alp313.2230
199-
image: aqa_alp313
200-
ports:
201-
- "2230:22"
202-
cpus: 2.0
203-
memory: 6G
204-
state: started # Make sure container is presented (if not exist then start it)
205-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
206-
detach: yes
207-
tags: startcontainers
208-
failed_when: false
209-
210-
- name: Start Alpine 3.14 container if not already started
211-
community.docker.docker_container:
212-
name: alp314.2231
213-
image: aqa_alp314
214-
ports:
215-
- "2231:22"
216-
cpus: 2.0
217-
memory: 6G
218-
state: started # Make sure container is presented (if not exist then start it)
219-
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
220-
detach: yes
221-
tags: startcontainers
222-
failed_when: false
223-
224-
- name: Start UBI8 container if not already started
225-
command: docker run --restart unless-stopped -p 2235:22 --cpus=2.0 --memory=6G --detach --name ubi8.2235 aqa_ubi8
226-
tags: startcontainers
227-
failed_when: false
228-
229-
- name: Start Deb11 container if not already started
230-
command: docker run --restart unless-stopped -p 2211:22 --cpus=2.0 --memory=6G --detach --name deb11.2211 aqa_deb11
231-
tags: startcontainers
232-
failed_when: false
233-
23416
# lineinfile does not work here - similar to the operation in /var/log in adopt_etc
23517
# lineinfile: path /proc/sys/kernel/core_pattern state: present: regexp: . line: core.%p
23618
# therefore the following section wil not become live prior to a reboot

0 commit comments

Comments
 (0)