-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathcapstone proj.txt
More file actions
148 lines (88 loc) · 2.55 KB
/
capstone proj.txt
File metadata and controls
148 lines (88 loc) · 2.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
1)Networking(VPC)
4 subnet
2 routing table
1 routing table (both private subnet)+don't enable public NAT Gateway
2 routing table ( other two subnet+igw)
igw (associate with vpc)
------------------------------
Terraform part of it:
s3 backend?
system dir-->s3 bucket + dynamodb (provider block), two rsources s3 + dynadmodb
When you use s3 bucket (10 terraform)-->current state -->Terraform apply (locking will be enabled
Lock-->key: value
networking dir--> provider+backend (s3bukcet, and key (statefile)
VPC-->subnet->igw-->routing-->routing table association
sg (443,80,22) key-pair
ssh-keygen
keypair (public key)
EC2 instance
instance dir-->provider+backend ( only key will change)
need data block(fetch datablock)
aws_instance type resource (any Linux os)
---------------------------------
Ansible
---
- name: Install apache httpd
ansible.builtin.apt:
name: apache2
state: present
update_cache: yes
- name: Copy file with owner and permissions
ansible.builtin.copy:
src: files/index.html
dest: /var/www/html
owner: root
group: root
----
pipeline {
agent any
stages {
stage('Checkout') {
steps {
// Checkout your Ansible playbook repository
git branch: 'main', url: ' https://github.com/amitopenwriteup/tfsource.git'
}
}
stage('Install Ansible') {
steps {
// Install Ansible on the Jenkins agent
sh 'sudo apt-get -y install ansible'
}
}
stage('Run Ansible Playbook') {
steps {
// Run the Ansible playbook
sh 'ansible-playbook -i inventory playbook.yaml'
}
}
}
---------------
k8s project
1) pv and pvc
static provision
2) Deployment [1 replica +hpa]: /var/www/html [static provision
https://www.openwriteup.com/?page_id=996
3) Service [Type LB], LB: NodePort
4) ip of your ubuntu vm
------------------------
----
remote exec
ssh
private key
public key
resource "aws_instance" "example" {
ami = "ami-0b8987a72eee28c3d" # Replace with your desired AMI ID
instance_type = "t2.micro"
subnet_id = "subnet-0e09953db95a5ac65" # Replace with your desired subnet ID
key_name = "my-key" # Replace with your desired key pair name
connection {
type = "ssh"
user = "ubuntu"
private_key = file("my-key.pem")
host = self.public_ip
}
provisioner "remote-exec" {
inline = ["sudo apt-get install apache",
]
}
}