Skip to content

Commit

Permalink
Adding golden-ami code of packer
Browse files Browse the repository at this point in the history
  • Loading branch information
neha-sinha20 committed Nov 18, 2022
1 parent e6f6a68 commit b87ca56
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ami/golden_org/linux_hardening/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: os-audit
hosts: localhost
become: true
roles:
- role: osm_linux_armour
4 changes: 4 additions & 0 deletions ami/golden_org/linux_hardening/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: osm_linux_armour
src: https://github.com/OT-OSM/linux_armour.git
scm: git
version: master
50 changes: 50 additions & 0 deletions ami/golden_org/packer_build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `access_key`}}",
"secret_key": "{{user `secret_key`}}",
"region": "{{user `region`}}",
"source_ami": "{{user `source_ami`}}",
"instance_type": "{{user `instance_type`}}",
"ssh_username": "{{user `ssh_username`}}",
"ami_name": "{{user `ami_name`}}-{{timestamp}}",
"vpc_id": "{{user `vpc_id`}}",
"subnet_id": "{{user `subnet_id`}}",
"security_group_id": "{{user `security_group_id`}}",
"skip_region_validation": true,
"associate_public_ip_address": true,
"tags": {
"Name": "{{user `ami_name`}}-{{timestamp}}",
"Os_hardening" : "true",
"Node-exporter" : "true",
"Environment": "global",
"Owner": "devops",
"Type": "golden"
}
}
],

"provisioners": [

{
"type": "shell",
"inline": ["sleep 30"]
},


{
"type": "file",
"source": "linux_hardening",
"destination": "/tmp/linux_hardening"
},

{
"type": "ansible-local",
"galaxy_command": "ansible-galaxy",
"galaxy_file": "linux_hardening/requirements.yml",
"playbook_file": "linux_hardening/playbook.yml"
}

]
}
11 changes: 11 additions & 0 deletions ami/golden_org/variable.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"region": "ap-south-1",
"source_ami": "ami-024c319d5d14b463e",
"instance_type": "t2.micro",
"ssh_username": "ubuntu",
"ami_name": "golden-ami",
"vpc_id": "vpc-0928ca75a3d30c971",
"subnet_id": "subnet-086ad3db8e3652bba",
"security_group_ids": "sg-01a18e59e1b026d8f",
"ami_virtualization_type": "hvm"
}

0 comments on commit b87ca56

Please sign in to comment.