Merge pull request #1638 from jpmens/ec2_userdata
Support for user_data in ec2 module
This commit is contained in:
commit
7c3520e369
1 changed files with 11 additions and 2 deletions
13
ec2
13
ec2
|
@ -82,7 +82,13 @@ options:
|
||||||
required: False
|
required: False
|
||||||
default: null
|
default: null
|
||||||
aliases: []
|
aliases: []
|
||||||
|
user_data:
|
||||||
|
version_added: "0.9"
|
||||||
|
description:
|
||||||
|
- opaque blob of data which is made available to the ec2 instance
|
||||||
|
required: False
|
||||||
|
default: null
|
||||||
|
aliases: []
|
||||||
examples:
|
examples:
|
||||||
- code: "local_action: ec2 keypair=admin instance_type=m1.large image=emi-40603AD1 wait=true group=webserver"
|
- code: "local_action: ec2 keypair=admin instance_type=m1.large image=emi-40603AD1 wait=true group=webserver"
|
||||||
description: "Examples from Ansible Playbooks"
|
description: "Examples from Ansible Playbooks"
|
||||||
|
@ -115,6 +121,7 @@ def main():
|
||||||
ec2_url = dict(aliases=['EC2_URL']),
|
ec2_url = dict(aliases=['EC2_URL']),
|
||||||
ec2_secret_key = dict(aliases=['EC2_SECRET_KEY']),
|
ec2_secret_key = dict(aliases=['EC2_SECRET_KEY']),
|
||||||
ec2_access_key = dict(aliases=['EC2_ACCESS_KEY']),
|
ec2_access_key = dict(aliases=['EC2_ACCESS_KEY']),
|
||||||
|
user_data = dict(),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -129,6 +136,7 @@ def main():
|
||||||
ec2_url = module.params.get('ec2_url')
|
ec2_url = module.params.get('ec2_url')
|
||||||
ec2_secret_key = module.params.get('ec2_secret_key')
|
ec2_secret_key = module.params.get('ec2_secret_key')
|
||||||
ec2_access_key = module.params.get('ec2_access_key')
|
ec2_access_key = module.params.get('ec2_access_key')
|
||||||
|
user_data = module.params.get('user_data')
|
||||||
|
|
||||||
if ec2_url:
|
if ec2_url:
|
||||||
os.environ['EC2_URL'] = ec2_url
|
os.environ['EC2_URL'] = ec2_url
|
||||||
|
@ -151,7 +159,8 @@ def main():
|
||||||
security_groups=[group],
|
security_groups=[group],
|
||||||
instance_type=instance_type,
|
instance_type=instance_type,
|
||||||
kernel_id=kernel,
|
kernel_id=kernel,
|
||||||
ramdisk_id=ramdisk)
|
ramdisk_id=ramdisk,
|
||||||
|
user_data=user_data)
|
||||||
|
|
||||||
instids = [ i.id for i in res.instances ]
|
instids = [ i.id for i in res.instances ]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue