forked from devopshobbies/devops-gpt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
90bece3
commit 54d507f
Showing
10 changed files
with
159 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
sudo dnf remove -y \ | ||
docker \ | ||
docker-client \ | ||
docker-client-latest \ | ||
docker-common \ | ||
docker-latest \ | ||
docker-latest-logrotate \ | ||
docker-logrotate \ | ||
docker-engine \ | ||
podman \ | ||
runc | ||
|
||
|
||
sudo dnf -y install dnf-plugins-core | ||
sudo dnf config-manager --add-repo https://download.docker.com/linux/rhel/docker-ce.repo | ||
|
||
sudo dnf install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
sudo dnf remove -y \ | ||
docker \ | ||
docker-client \ | ||
docker-client-latest \ | ||
docker-common \ | ||
docker-latest \ | ||
docker-latest-logrotate \ | ||
docker-logrotate \ | ||
docker-engine | ||
|
||
|
||
sudo dnf -y install dnf-plugins-core | ||
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo | ||
|
||
sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
sudo dnf remove -y \ | ||
docker \ | ||
docker-client \ | ||
docker-client-latest \ | ||
docker-common \ | ||
docker-latest \ | ||
docker-latest-logrotate \ | ||
docker-logrotate \ | ||
docker-selinux \ | ||
docker-engine-selinux \ | ||
docker-engine | ||
|
||
|
||
sudo dnf -y install dnf-plugins-core | ||
sudo dnf-3 config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo | ||
|
||
|
||
sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
sudo apt-get update -y | ||
sudo apt-get install ca-certificates curl -y | ||
sudo install -m 0755 -d /etc/apt/keyrings | ||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | ||
sudo chmod a+r /etc/apt/keyrings/docker.asc | ||
|
||
# Add the repository to Apt sources: | ||
echo \ | ||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | ||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | ||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
sudo apt-get update -y | ||
|
||
|
||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
#!bin/bash | ||
#!/bin/bash | ||
sudo apt-get update -y | ||
sudo apt-get install ca-certificates curl -y | ||
sudo install -m 0755 -d /etc/apt/keyrings | ||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc | ||
sudo chmod a+r /etc/apt/keyrings/docker.asc | ||
|
||
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common | ||
# Add the repository to Apt sources: | ||
echo \ | ||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ | ||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | ||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
sudo apt-get update -y | ||
|
||
wget -O- https://apt.releases.hashicorp.com/gpg | \ | ||
gpg --dearmor | \ | ||
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null | ||
|
||
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] \ | ||
https://apt.releases.hashicorp.com $(lsb_release -cs) main" | \ | ||
sudo tee /etc/apt/sources.list.d/hashicorp.list | ||
|
||
sudo apt update | ||
|
||
sudo apt-get install terraform | ||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
from typing import Dict, List, Optional,Union | ||
from pydantic import BaseModel, model_validator,validator | ||
|
||
class DockerInstallationInput(BaseModel): | ||
os:str = "Ubuntu" | ||
environment:str = "Linux" | ||
|
||
@validator("os") | ||
def validate_os(cls, value): | ||
allowed_os = ['Ubuntu', 'Centos', 'Fedora', 'RHEL'] | ||
if value not in allowed_os: | ||
raise ValueError(f"OS must be one of {allowed_os}.") | ||
return value | ||
|
||
@validator("environment") | ||
def validate_environment(cls, value): | ||
allowed_os = ['Linux'] | ||
if value not in allowed_os: | ||
raise ValueError(f"Environment must be one of {allowed_os}.") | ||
return value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os | ||
import shutil | ||
|
||
|
||
def create_MyBash_directory(): | ||
|
||
dir = 'app/media/MyBash' | ||
|
||
|
||
if not os.path.exists(dir): | ||
os.makedirs(dir) | ||
os.path.join(dir, 'bash.sh') | ||
|
||
|
||
|
||
def docker_installation_selection(input): | ||
|
||
create_MyBash_directory() | ||
|
||
match input.os: | ||
|
||
case "Ubuntu": | ||
|
||
source = 'app/media/Installation_base/Docker/ubuntu.sh' | ||
dest = 'app/media/MyBash/bash.sh' | ||
|
||
shutil.copyfile(source, dest) | ||
|
||
|
||
case "Fedora": | ||
source = 'app/media/Installation_base/Docker/fedora.sh' | ||
dest = 'app/media/MyBash/bash.sh' | ||
shutil.copyfile(source, dest) | ||
|
||
case "Centos": | ||
source = 'app/media/Installation_base/Docker/centos.sh' | ||
dest = 'app/media/MyBash/bash.sh' | ||
shutil.copyfile(source, dest) | ||
|
||
case "RHEL": | ||
source = 'app/media/Installation_base/Docker/RHEL.sh' | ||
dest = 'app/media/MyBash/bash.sh' | ||
shutil.copyfile(source, dest) | ||
case _: | ||
raise ValueError() |