Skip to content

Commit 981f435

Browse files
committed
2 parents 7dd8ea1 + a636947 commit 981f435

File tree

10 files changed

+67
-47
lines changed

10 files changed

+67
-47
lines changed

01-jenkins-setup/ansible/jenkins-controller.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
vars:
88
efs_mount_dir: "/data"
99
jenkins_data_dir: "/data/jenkins"
10-
jenkins_lts_version: "2.387.1"
10+
jenkins_lts_version: "2.492.1"
1111

1212

1313
roles:

01-jenkins-setup/ansible/roles/jenkins-agent/tasks/ssh.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
script: "{{ playbook_dir }}/scripts/get-ssh-pub.py {{ public_key_path }}"
44
args:
55
executable: /usr/bin/python3
6-
remote_src: yes
76
register: secret_value
87

98
- name: Print registered variable

01-jenkins-setup/ansible/roles/jenkins-agent/tasks/tools.yaml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,41 @@
99
name: python3-pip
1010
state: present
1111

12-
- name: Install boto3 using pip3
13-
become: true
14-
pip:
15-
name: boto3
12+
- name: Install boto3 using apt
13+
apt:
14+
name: python3-boto3
1615
state: present
16+
become: yes
1717

18-
- name: Install AWS CLI using pip
19-
become: true
20-
pip:
21-
name: awscli
22-
state: latest
23-
executable: pip3
18+
- name: Install dependencies
19+
apt:
20+
name:
21+
- curl
22+
- unzip
23+
state: present
24+
25+
- name: Download AWS CLI installation script
26+
shell: curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
27+
28+
- name: Unzip AWS CLI installation package
29+
unarchive:
30+
src: /tmp/awscliv2.zip
31+
dest: /tmp/
32+
remote_src: yes
33+
34+
- name: Install AWS CLI
35+
shell: sudo /tmp/aws/install
2436

2537
- name: Install Ansible
26-
pip:
38+
apt:
2739
name: ansible
2840
state: latest
2941

30-
- name: Add HashiCorp GPG key
31-
become: yes
32-
shell: "wget -qO- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg"
42+
- name: Download and convert HashiCorp GPG key in one step
43+
shell: |
44+
curl -fsSL https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
45+
args:
46+
creates: /usr/share/keyrings/hashicorp-archive-keyring.gpg
3347

3448
- name: Add HashiCorp APT repository
3549
become: yes

01-jenkins-setup/ansible/roles/jenkins-controller/tasks/base.yaml

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,30 @@
1313
name: python3-pip
1414
state: present
1515

16-
- name: Install boto3 using pip3
17-
become: true
18-
pip:
19-
name: boto3
16+
- name: Install boto3 using apt
17+
apt:
18+
name: python3-boto3
19+
state: present
20+
become: yes
21+
22+
- name: Install dependencies
23+
apt:
24+
name:
25+
- curl
26+
- unzip
2027
state: present
2128

22-
- name: Install AWS CLI using pip
23-
become: true
24-
pip:
25-
name: awscli
26-
state: latest
27-
executable: pip3
29+
- name: Download AWS CLI installation script
30+
shell: curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
31+
32+
- name: Unzip AWS CLI installation package
33+
unarchive:
34+
src: /tmp/awscliv2.zip
35+
dest: /tmp/
36+
remote_src: yes
37+
38+
- name: Install AWS CLI
39+
shell: sudo /tmp/aws/install
2840

2941
- name: Install Java JDK 17
3042
apt:

01-jenkins-setup/jenkins-agent.pkr.hcl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
variable "ami_id" {
22
type = string
3-
default = "ami-0735c191cf914754d"
3+
default = "ami-04b4f1a9cf54c11d0"
44
}
55

66
variable "public_key_path" {
@@ -16,7 +16,7 @@ source "amazon-ebs" "jenkins" {
1616
ami_name = "${local.app_name}"
1717
instance_type = "t2.micro"
1818
region = "us-west-2"
19-
availability_zone = "us-west-2a"
19+
availability_zone = "us-west-2b"
2020
source_ami = "${var.ami_id}"
2121
ssh_username = "ubuntu"
2222
iam_instance_profile = "jenkins-instance-profile"
@@ -31,7 +31,8 @@ build {
3131

3232
provisioner "ansible" {
3333
playbook_file = "ansible/jenkins-agent.yaml"
34-
extra_arguments = [ "--extra-vars", "public_key_path=${var.public_key_path}", "--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" ]
34+
user = "ubuntu"
35+
extra_arguments = [ "--extra-vars", "public_key_path=${var.public_key_path}", "--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa" ]
3536
}
3637

3738
post-processor "manifest" {

01-jenkins-setup/jenkins-controller.pkr.hcl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
variable "ami_id" {
22
type = string
3-
default = "ami-0735c191cf914754d"
3+
default = "ami-04b4f1a9cf54c11d0"
44
}
55

66
variable "efs_mount_point" {
@@ -9,14 +9,14 @@ variable "efs_mount_point" {
99
}
1010

1111
locals {
12-
app_name = "jenkins-controller"
12+
app_name = "jenkins-controller-updated"
1313
}
1414

1515
source "amazon-ebs" "jenkins" {
1616
ami_name = "${local.app_name}"
1717
instance_type = "t2.micro"
1818
region = "us-west-2"
19-
availability_zone = "us-west-2a"
19+
availability_zone = "us-west-2b"
2020
source_ami = "${var.ami_id}"
2121
ssh_username = "ubuntu"
2222
tags = {
@@ -30,7 +30,8 @@ build {
3030

3131
provisioner "ansible" {
3232
playbook_file = "ansible/jenkins-controller.yaml"
33-
extra_arguments = [ "--extra-vars", "ami-id=${var.ami_id} efs_mount_point=${var.efs_mount_point}", "--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa" ]
33+
user = "ubuntu"
34+
extra_arguments = [ "--extra-vars", "ami-id=${var.ami_id} efs_mount_point=${var.efs_mount_point}", "--scp-extra-args", "'-O'", "--ssh-extra-args", "-o IdentitiesOnly=yes -o HostKeyAlgorithms=+ssh-rsa" ]
3435
}
3536

3637
post-processor "manifest" {

01-jenkins-setup/terraform/agent/main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@ provider "aws" {
44

55
module "ec2_instance" {
66
source = "../modules/ec2"
7-
87
instance_name = "jenkins-agent"
9-
ami_id = "ami-0e68ab34763bcba1f"
8+
ami_id = "ami-0fe5ed92a8c77d79f"
109
instance_type = "t2.small"
1110
key_name = "techiescamp"
12-
subnet_ids = ["subnet-058a7514ba8adbb07", "subnet-0dbcd1ac168414927", "subnet-032f5077729435858"]
11+
subnet_ids = ["subnet-046c3f4390fc51b7e", "subnet-02727435b393c516c", "subnet-0ed1c80066f1be7ed"]
1312
instance_count = 1
1413
}

01-jenkins-setup/terraform/efs/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ provider "aws" {
44

55
module "efs_module" {
66
source = "../modules/efs"
7-
vpc_id = "vpc-0a5ca4a92c2e10163"
8-
subnet_ids = ["subnet-058a7514ba8adbb07", "subnet-0dbcd1ac168414927", "subnet-032f5077729435858"]
7+
vpc_id = "vpc-0872a2ffd55e763ca"
8+
subnet_ids = ["subnet-046c3f4390fc51b7e", "subnet-02727435b393c516c", "subnet-0ed1c80066f1be7ed"]
99
}

01-jenkins-setup/terraform/lb-asg/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ provider "aws" {
44

55
module "lb-asg" {
66
source = "../modules/lb-asg"
7-
subnets = ["subnet-058a7514ba8adbb07", "subnet-0dbcd1ac168414927", "subnet-032f5077729435858"]
8-
ami_id = "ami-074d40b56472c5b9b"
7+
subnets = ["subnet-046c3f4390fc51b7e", "subnet-02727435b393c516c", "subnet-0ed1c80066f1be7ed"]
8+
ami_id = "ami-0e9419006a1fc1387"
99
instance_type = "t2.small"
1010
key_name = "techiescamp"
1111
environment = "dev"
12-
vpc_id = "vpc-0a5ca4a92c2e10163"
12+
vpc_id = "vpc-0872a2ffd55e763ca"
1313
}

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@ The following are the best bundles to **save 38% (up to $788)** with code **DCUB
2121
- KCSA + CKS Exam Bundle ($229 Savings) [kube.promo/kcsa-cks](https://kube.promo/kcsa-cks)
2222
- KCNA + KCSA Exam Bundle ($203 Savings) [kube.promo/kcna-kcsa](https://kube.promo/kcna-kcsa)
2323

24-
> [!NOTE]
25-
>⌛ Act fast—this limited-time offer won’t be around much longer!
26-
> You have one year of validity to appear for the certification exam after registration
27-
28-
> If you Looking for an organized way to learn Kubernetes and prepare for the CKA exam? Check out our [Complete CKA Certification Course](https://techiescamp.com/p/cka-complete-prep-course-practice-tests). It includes illustrations, hands-on exercises, real-world examples, and dedicated Discord support. Use code **DCUBE25** to get 25% OFF! .
29-
3024
## Real-World DevOps Projects
3125

3226
1. [Jenkins HA Setup On AWS](https://github.com/techiescamp/devops-projects/tree/main/01-jenkins-setup)

0 commit comments

Comments
 (0)