NOTE:
974 mkdir sourcepath
975 cd sourcepath/
976 wget https://www.free-css.com/assets/files/free-css-templates/download/page276/transportz.zip
977 ll
978 unzip transportz.zip
979 ll
980 rm -rf transportz.zip
981 ll
982 cp -rvf transportz/* .
983 rm -rf transportz/
packer build aws.json
now to n.virginia region
go to ami
launch image
go to ec2 dashboard
launch instance
all traffic anywhere
use public ip of that with 8080 and see website'
vim moo.json
{
"builders": [
{
"type": "amazon-ebs",
"access_key": "AGQ",
"secret_key": "K1aurid",
"region": "us-east-1",
"instance_type": "t2.micro",
"source_ami": "ami-02e136e904f3da870",
"ssh_username": "ec2-user",
"ami_name": "moonu-amiii"
}
],
"provisioners": [
{:wq
"type": "ansible",
"user": "ec2-user",
"playbook_file": "./playbook.yaml"
}
]
}
=========================================================
ansible playbook
===================================
playbook.json
- name: packer project
hosts: all
become: true
tasks:
- name: install apache
package:
name: 'httpd'
state: present
- copy:
src: /sourcepath/
dest: /var/www/html/
- lineinfile:
path: /etc/httpd/conf/httpd.conf
regexp: '^Listen'
insertafter: '^#Listen'
line: 'Listen 8080'
- service:
name: httpd
state: started
enabled: yes
Comments
Post a Comment