Skip to content

Commit

Permalink
Merge branch 'master' into xcode_offline_role
Browse files Browse the repository at this point in the history
  • Loading branch information
mahdipub committed Apr 23, 2024
2 parents c1f579b + b26a406 commit f6f2995
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 229 deletions.
1 change: 1 addition & 0 deletions ansible/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ hosts:

- azure:
ubuntu2204-x64-1: {ip: 52.180.147.157, description: Xeon Platinum 8272CL, 16 cores, 64GB}
ubuntu2204-x64-2: {ip: 20.83.24.86, description: 16 cores, 64GB}

- equinix:
ubuntu2204-x64-1: {ip: 145.40.113.173, description: Intel Xeon Gold 40 core}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM registry.suse.com/suse/sles12sp5:latest

RUN zypper ar https://download.opensuse.org/distribution/leap/15.4/repo/oss/ sles15oss
RUN zypper --gpg-auto-import-keys refresh
RUN zypper update -y && zypper install -y wget perl openssh-server unzip zip tar gzip
RUN zypper update -y && zypper install -y wget perl openssh-server unzip zip tar gzip hostname

RUN wget 'https://api.adoptium.net/v3/binary/latest/17/ga/linux/x64/jdk/hotspot/normal/eclipse?project=jdk' -O /tmp/jdk17.tar.gz
RUN mkdir -p /usr/lib/jvm/jdk17 && tar -xpzf /tmp/jdk17.tar.gz -C /usr/lib/jvm/jdk17 --strip-components=1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
#################################################
# Build basic test images for each distribution #
#################################################
##########################################
# Config changes for Dockerhost machines #
##########################################

- name: Enable ipv6 on Dockerhost
lineinfile:
Expand All @@ -13,224 +13,6 @@
notify:
- Restart docker service

- name: Send Dockerfiles to remote machine
copy:
src: Dockerfiles/
dest: /tmp/Dockerfiles/

- name: Collate all Dockerfile names
find:
paths: "/tmp/Dockerfiles/"
patterns: "Dockerfile.*"
register: dockerfiles

# Defaulting to x64 in Dockerfiles means no need to special case that one
# since API architecture = ansible_architecture everywhere else we use this
- name: Translate architecture name in dockerfiles
replace: dest={{ item.path }} regexp="arch=x64" replace="arch={{ ansible_architecture }}"
with_items: "{{ dockerfiles.files }}"
when: ansible_architecture != "x86_64"

- name: Set jenkins authorized_Key in dockerfiles
replace: dest={{ item.path }} regexp="Jenkins_User_SSHKey" replace="{{ Jenkins_User_SSHKey }}"
with_items: "{{ dockerfiles.files }}"

- name: Create docker images for each distribution for test
command: docker build --cpu-period=100000 --cpu-quota=800000 -t aqa_{{ item }} --memory=8G -f /tmp/Dockerfiles/Dockerfile.{{ item }} /tmp/Dockerfiles
with_items:
- u1604
- u1804
- u2004
- u2104
- f33
- f34
- f35
- alp311
- alp312
- alp313
- alp314
- ubi8
- deb11

##############################################################
# Start the containers #
# If startallcontainers is skipped, only start three of them #
# ignore_errors simplest way to ignore if already started #
# #
# TODO: Check if started rather than ignore error? #
# hard to 'docker_container_info depends on start time #
# TODO: Use a calculated value instead of 2 core/6Gb #
##############################################################

- name: Start Ubuntu 16.04 container if not already started
community.docker.docker_container:
name: U1604_2222
image: aqa_u1604
ports:
- "2222:22"
cpus: 2.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers
failed_when: false

- name: Start Ubuntu 18.04 container if not already started
community.docker.docker_container:
name: U1804_2223
image: aqa_u1804
ports:
- "2223:22"
cpus: 4.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers, startallcontainers
failed_when: false

- name: Start Ubuntu 20.04 container if not already started
community.docker.docker_container:
name: U2004_2224
image: aqa_u2004
ports:
- "2224:22"
cpus: 2.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers
failed_when: false

- name: Start Ubuntu 21.04 container if not already started
community.docker.docker_container:
name: U2104_2225
image: aqa_aqa_u2104u2004
ports:
- "2225:22"
cpus: 4.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers, startallcontainers
failed_when: false

- name: Start Ubuntu 22.04 container if not already started
command: docker run --restart unless-stopped -p 2226:22 --cpus=4.0 --memory=6G --detach --name U2204_2226 aqa_u2204
tags: startcontainers, startallcontainers
failed_when: false

- name: Start fedora 33 container if not already started
community.docker.docker_container:
name: f33.2227
image: aqa_f33
ports:
- "2227:22"
cpus: 2.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers
failed_when: false

- name: Start fedora 34 container if not already started
community.docker.docker_container:
name: f34.2232
image: aqa_f34
ports:
- "2232:22"
cpus: 2.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers
failed_when: false

- name: Start fedora 35 container if not already started
community.docker.docker_container:
name: f35.2233
image: aqa_f35
ports:
- "2233:22"
cpus: 2.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers
failed_when: false

- name: Start Alpine 3.11 container if not already started
community.docker.docker_container:
name: alp311.2228
image: aqa_alp311
ports:
- "2228:22"
cpus: 2.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers, startallcontainers
failed_when: false

- name: Start Alpine 3.12 container if not already started
community.docker.docker_container:
name: alp312.2229
image: aqa_alp312
ports:
- "2229:22"
cpus: 2.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers
failed_when: false

- name: Start Alpine 3.13 container if not already started
community.docker.docker_container:
name: alp313.2230
image: aqa_alp313
ports:
- "2230:22"
cpus: 2.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers
failed_when: false

- name: Start Alpine 3.14 container if not already started
community.docker.docker_container:
name: alp314.2231
image: aqa_alp314
ports:
- "2231:22"
cpus: 2.0
memory: 6G
state: started # Make sure container is presented (if not exist then start it)
restart: yes # Use restart to force a matching container to be stopped and restarted (if exist then restart it)
detach: yes
tags: startcontainers
failed_when: false

- name: Start UBI8 container if not already started
command: docker run --restart unless-stopped -p 2235:22 --cpus=2.0 --memory=6G --detach --name ubi8.2235 aqa_ubi8
tags: startcontainers
failed_when: false

- name: Start Deb11 container if not already started
command: docker run --restart unless-stopped -p 2211:22 --cpus=2.0 --memory=6G --detach --name deb11.2211 aqa_deb11
tags: startcontainers
failed_when: false

# lineinfile does not work here - similar to the operation in /var/log in adopt_etc
# lineinfile: path /proc/sys/kernel/core_pattern state: present: regexp: . line: core.%p
# therefore the following section wil not become live prior to a reboot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
download and copy (soft link) xcode offline files heare:
download and copy (soft link maybe) xcode offline files here:
Xcode_12.4.xip
Xcode_13.1.xip
etc.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
#########################
# Xcdde offline install #
# Xcode offline install #
#########################

# Install Xcode withou need to login with appleID
# Install Xcode without needing to login with appleID
# Path /Applications/Xcode.app/
# Requires the following variable:
# xcode_version: 12.4 | 13.1 | 13.2.1 | 13.4 | 14.3.1 | 15.0.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
---

- name: Check if Homebrew is already installed
- name: Check if Homebrew is already installed (x86_64)
stat:
path: /usr/local/bin/brew
register: b
when: ansible_architecture == "x86_64"
tags: brew

- name: Check if Homebrew is already installed
- name: Check if Homebrew is already installed (arm64)
stat:
path: /opt/homebrew/bin/brew
register: b
Expand All @@ -23,7 +23,7 @@
when: not brew_is_installed
tags: brew
block:
- name: Add user j9admin to sudoers
- name: Add ansible user to sudoers
template:
src: sudoers
dest: /etc/sudoers.d/{{ ansible_user }}
Expand Down Expand Up @@ -78,7 +78,7 @@
eval $(/opt/homebrew/bin/brew shellenv)
when: ansible_architecture == "arm64"

- name: Remove user j9admin from sudoers
- name: Remove user ansible from sudoers
file:
path: /etc/sudoers.d/{{ ansible_user }}
state: absent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,31 @@
- desktop_installed.stat.exists
- gui_disabled.stdout == ''
tags: disable_gui

# Restart NTPD On Centos 7 after gui disablement

- name: Gather Facts About The Services Present
service_facts:
tags: disable_gui

- name: Check If NTPD Exists In The Service Facts
set_fact:
ntpd_entry_exists: "{{ 'ntpd.service' in services }}"
when: ansible_facts.services is defined
tags: disable_gui

- name: Set Fact Where NTPD Is Not Available As A Service
set_fact:
ntpd_entry_exists: "false"
when: ansible_facts.services is not defined
tags: disable_gui

- name: Start NTP for CentOS7 following GUI disablement
service:
name: ntpd
state: restarted
enabled: yes
when:
- ntpd_entry_exists | default(false) | bool
- (ansible_distribution == "CentOS" and ansible_distribution_major_version == "7" )
tags: disable_gui

0 comments on commit f6f2995

Please sign in to comment.