◼️ Jenkins is a free and open source automation server.
◼️ It helps automate the parts of software development related to building, testing, and deploying, facilitating continuous integration and continuous delivery.
- 1 VPC
- 6 Subnets
- 3 Private Subents
- 3 Public Subnets
- Public subnets should have IGW attached to it
- Private subnets should have NG attached to it
- Configure route tables
- To check if everything is configured properly, create ec2 instance, manually, on public subnet and ping www.google.com
- If everything is successful, you should have proper response ↑ 👍
provisioner "remote-exec" {
connection {
type = "ssh"
user = "ec2-user"
private_key = "${file("~/.ssh/id_rsa")}"
host = "${aws_instance.jenkins_server.public_ip}"
}
inline = [
]
1. Jenkins is a Java application, so the first step is to install Java.
"sudo yum install java${var.java_version} -y",
2. The next step is to enable the Jenkins repository.
"curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo",
3. Add the repository to your system.
"sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key",
4. Once the repository is enabled, install the latest stable version of Jenkins.
"sudo yum install ${var.jenksins_version} -y",
5. After the installation process is completed, start the Jenkins service.
"sudo systemctl start jenkins",
6. Enable the Jenkins service to start on system boot.
"sudo systemctl enable jenkins",
7. This inline command string prints the output for Jenkins Initial Administrator Password.
"echo -e $(tput setaf 1 )'Jenkins initialAdminPassword: '$(tput sgr0) $(tput setaf 2)`
sudo cat /var/lib/jenkins/secrets/initialAdminPassword`$(tput sgr0)",