Created
February 20, 2019 21:12
-
-
Save SwampDragons/444a752804c0b47e74137c59fe0e49e8 to your computer and use it in GitHub Desktop.
Cool New Features in Packer Sample Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"builders": [ | |
{ | |
"type": "null", | |
"communicator": "none" | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "shell-local", | |
"inline": "echo hi" | |
}, | |
{ | |
"type": "breakpoint", | |
"note": "this is a breakpoint" | |
}, | |
{ | |
"type": "breakpoint", | |
"disable": true, | |
"note": "this is a disabled breakpoint" | |
}, | |
{ | |
"type": "shell-local", | |
"inline": "echo hi 2" | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"builders": [ | |
{ | |
"type": "null", | |
"communicator": "none" | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "shell-local", | |
"environment_vars": ["VERS={{ user `service_version`}}"], | |
"command": "echo http://download.example.com/version/$VERS" | |
} | |
], | |
"variables": { | |
"service_version": "{{ consul_key `myservice/version`}}" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"variables": { | |
"super_secret_password": "ilovewaffles" | |
}, | |
"sensitive-variables": [ | |
"super_secret_password" | |
], | |
"builders": [ | |
{ | |
"type": "null", | |
"communicator": "none" | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "shell-local", | |
"environment_vars": ["MYPASS={{ user `super_secret_password`}}"], | |
"inline": ["echo $MYPASS > /dev/null"] | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"builders": [ | |
{ | |
"ami_name": "packer-vault-aws-demo", | |
"force_deregister": true, | |
"force_delete_snapshot": true, | |
"instance_type": "t2.micro", | |
"source_ami_filter": { | |
"filters": { | |
"virtualization-type": "hvm", | |
"name": "ubuntu/images/*ubuntu-xenial-16.04-amd64-server-*", | |
"root-device-type": "ebs" | |
}, | |
"owners": ["099720109477"], | |
"most_recent": true | |
}, | |
"ssh_username": "ubuntu", | |
"type": "amazon-ebs", | |
"vault_aws_engine": { | |
"name": "my-role" | |
} | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "shell", | |
"inline": ["echo hi"] | |
} | |
] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"builders": [ | |
{ | |
"type": "null", | |
"communicator": "none" | |
} | |
], | |
"provisioners": [ | |
{ | |
"type": "shell-local", | |
"environment_vars": ["MYSECRET={{ user `VAULT_SECRET`}}"], | |
"command": "echo MYSECRET is $MYSECRET" | |
} | |
], | |
"variables": { | |
"VAULT_SECRET": "{{ vault `/secret/data/hello` `foo`}}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment