# Terraform Infrastructure
provider "aws" {
region = "us-east-1"
}
resource "aws_instance" "app_server" {
ami = "ami-1234567890abcdef0"
instance_type = "t3.micro"
tags = {
Name = "DevOpsMayurDemo"
}
}
# Ansible Configuration
---
- name: Configure Web Servers
hosts: webservers
become: yes
vars:
http_port: 80
max_clients: 200
tasks:
- name: Install nginx
apt:
name: nginx
state: latest
update_cache: yes
- name: Start nginx service
service:
name: nginx
state: started
enabled: yes
- name: Deploy configuration file
template:
src: templates/nginx.conf.j2
dest: /etc/nginx/nginx.conf
notify: Restart nginx
handlers:
- name: Restart nginx
service:
name: nginx
state: restarted
---
# Vault Configuration
vault {
address = "https://vault.example.com:8200"
}
# Enable AppRole auth method
vault auth enable approle
# Create a named role with policies
vault write auth/approle/role/webapp \
token_ttl=1h \
token_max_ttl=4h \
token_policies="webapp-policy"
# Create policy for the webapp
vault policy write webapp-policy -<
Mayur Gandhi
Cloud Architect | AWS · GCP · Terraform · AIOps · Vault
Staff Engineer @ HashiCorp.
Building and Delivering secure and automated infrastructure.
Focus on regulated financial services.