-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #735 Add cloud-config.yaml UserData to basic EC2 example
* Assumes cloud-config.yaml is in same dir as script * Example substitutes hostname and FQDN * yaml file also uses cf-style template strings for dual usage * Modify Test runner to pass __file__ global to exec
- Loading branch information
1 parent
35bdfbf
commit 4ef088a
Showing
4 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#cloud-config | ||
hostname: ${InstanceHostname} | ||
fqdn: ${InstanceHostname}.${PublicDomainName} | ||
manage_etc_hosts: true | ||
package_update: true | ||
package_upgrade: true | ||
packages: | ||
- build-essential | ||
- curl | ||
- git | ||
runcmd: | ||
- | | ||
echo "-----BEGIN RSA PRIVATE KEY----- | ||
AAAAAAAAAAAAAAAAAAAAAAAAAA | ||
-----END RSA PRIVATE KEY----- | ||
" > /home/ubuntu/.ssh/id_rsa | ||
- chmod 600 /home/ubuntu/.ssh/id_rsa | ||
- chown ubuntu:ubuntu /home/ubuntu/.ssh/id_rsa | ||
- ssh -oStrictHostKeyChecking=no -T [email protected] | ||
ssh_authorized_keys: | ||
- ssh-rsa AAAA== | ||
- ssh-rsa AAAA== | ||
power_state: | ||
timeout: 120 | ||
message: Rebooting to ensure hostname has stuck correctly and apply any kernel updates | ||
mode: reboot |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,7 +103,7 @@ | |
"default" | ||
], | ||
"UserData": { | ||
"Fn::Base64": "80" | ||
"Fn::Base64": "#cloud-config\nhostname: hostname\nfqdn: hostname.hostname.example.com\nmanage_etc_hosts: true\npackage_update: true\npackage_upgrade: true\npackages:\n - build-essential\n - curl\n - git\nruncmd:\n - |\n echo \"-----BEGIN RSA PRIVATE KEY-----\n AAAAAAAAAAAAAAAAAAAAAAAAAA\n -----END RSA PRIVATE KEY-----\n \" > /home/ubuntu/.ssh/id_rsa\n - chmod 600 /home/ubuntu/.ssh/id_rsa\n - chown ubuntu:ubuntu /home/ubuntu/.ssh/id_rsa\n - ssh -oStrictHostKeyChecking=no -T [email protected]\nssh_authorized_keys:\n - ssh-rsa AAAA==\n - ssh-rsa AAAA==\npower_state:\n timeout: 120\n message: Rebooting to ensure hostname has stuck correctly and apply any kernel updates\n mode: reboot\n" | ||
} | ||
}, | ||
"Type": "AWS::EC2::Instance" | ||
|
This file contains 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