-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathawsne-packer.json
57 lines (57 loc) · 1.96 KB
/
awsne-packer.json
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
{
"builders": [
{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key_id`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "eu-west-1",
"source_ami": "ami-d834aba1",
"ami_virtualization_type": "hvm",
"instance_type": "t2.small",
"vpc_id": "vpc-b1f208d4",
"subnet_id": "subnet-57a10c32",
"ssh_username": "ec2-user",
"ssh_timeout": "3m",
"ssh_pty": "true",
"ami_name": "awsne_{{isotime | clean_ami_name}}",
"tags": {
"Name": "AWS NE Packer",
"CreationDate": "{{timestamp}}",
"Builder": "Packer",
"Provisioner": "Ansible"
}
}
],
"provisioners": [
{
"execute_command": "echo 'ec2-user' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"type": "shell",
"script": "scripts/sudoers.sh"
},
{
"execute_command": "echo 'ec2-user' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"type": "shell",
"inline": ["yum -y update", "reboot && sleep 60"],
"expect_disconnect": true
},
{
"execute_command": "echo 'ec2-user' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"type": "shell",
"inline": [ "yum install -y python26-pip", "pip install ansible" ]
},
{
"type": "ansible-local",
"playbook_file": "ansible/playbook.yml",
"playbook_dir": "ansible"
},
{
"execute_command": "echo 'ec2-user' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
"type": "shell",
"inline": ["rm -rf /tmp/*", "rm -f /tmp/.ansible-lock.*"]
}
],
"variables": {
"aws_access_key_id": "{{env `PACKER_AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `PACKER_AWS_SECRET_ACCESS_KEY`}}"
}
}