-
Notifications
You must be signed in to change notification settings - Fork 77
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
Showing
6 changed files
with
104 additions
and
19 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,32 @@ | ||
data "aws_ami" "amazon_linux" { | ||
most_recent = true | ||
|
||
filter { | ||
name = "name" | ||
values = ["amzn2-ami-hvm-*-x86_64-gp2"] | ||
|
||
} | ||
|
||
filter { | ||
name = "virtualization-type" | ||
values = ["hvm"] | ||
} | ||
|
||
owners = ["amazon"] | ||
} | ||
|
||
data "aws_ami" "ubuntu_linux" { | ||
most_recent = true | ||
|
||
filter { | ||
name = "name" | ||
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*", "ubuntu/images/hvm-ssd/ubuntu-lunar-24.04-amd64-server-*"] | ||
} | ||
|
||
filter { | ||
name = "virtualization-type" | ||
values = ["hvm"] | ||
} | ||
|
||
owners = ["amazon"] | ||
} |
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,32 @@ | ||
data "aws_ami" "amazon_linux" { | ||
most_recent = true | ||
|
||
filter { | ||
name = "name" | ||
values = ["amzn2-ami-hvm-*-x86_64-gp2"] | ||
|
||
} | ||
|
||
filter { | ||
name = "virtualization-type" | ||
values = ["hvm"] | ||
} | ||
|
||
owners = ["amazon"] | ||
} | ||
|
||
data "aws_ami" "ubuntu_linux" { | ||
most_recent = true | ||
|
||
filter { | ||
name = "name" | ||
values = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*", "ubuntu/images/hvm-ssd/ubuntu-lunar-24.04-amd64-server-*"] | ||
} | ||
|
||
filter { | ||
name = "virtualization-type" | ||
values = ["hvm"] | ||
} | ||
|
||
owners = ["amazon"] | ||
} |
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
File renamed without changes.
38 changes: 38 additions & 0 deletions
38
tf-ec2-with-modules/terraform-project/scripts/install-jenkins-ubuntu-linux.sh
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,38 @@ | ||
#!/bin/bash | ||
|
||
# Update the package index | ||
sudo apt-get update -y | ||
|
||
# Install Java 17 (latest stable version required for Jenkins) | ||
sudo apt-get install openjdk-17-jdk -y | ||
|
||
# Set JAVA_HOME environment variable | ||
echo "export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64" | sudo tee -a /etc/profile | ||
echo "export PATH=\$JAVA_HOME/bin:\$PATH" | sudo tee -a /etc/profile | ||
source /etc/profile | ||
|
||
# Enable the Jenkins repository | ||
wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add - | ||
sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list' | ||
|
||
# Update the package index again | ||
sudo apt-get update -y | ||
|
||
# Install Jenkins | ||
sudo apt-get install jenkins -y | ||
|
||
# Start the Jenkins service | ||
sudo systemctl start jenkins | ||
|
||
# Enable Jenkins to start on system boot | ||
sudo systemctl enable jenkins | ||
|
||
# Wait for Jenkins to complete setup | ||
echo "Waiting for Jenkins to complete setup..." | ||
while [ ! -f /var/lib/jenkins/secrets/initialAdminPassword ]; do | ||
sleep 10 | ||
done | ||
|
||
# Print the Jenkins initial admin password | ||
echo "Jenkins initial admin password:" | ||
sudo cat /var/lib/jenkins/secrets/initialAdminPassword |