Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ec2] Use user_data if specified #54494

Merged
merged 2 commits into from
Apr 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/54494-ec2-user-data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bugfixes:
- ec2 - Only use user_data if the user has specified a value.
This prevents setting the instance's user data to b'None'.
5 changes: 3 additions & 2 deletions lib/ansible/modules/cloud/amazon/ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,8 +1070,9 @@ def create_instances(module, ec2, vpc, override_count=None):
'placement': zone,
'instance_type': instance_type,
'kernel_id': kernel,
'ramdisk_id': ramdisk,
'user_data': to_bytes(user_data, errors='surrogate_or_strict')}
'ramdisk_id': ramdisk}
if user_data is not None:
params['user_data'] = to_bytes(user_data, errors='surrogate_or_strict')

if ebs_optimized:
params['ebs_optimized'] = ebs_optimized
Expand Down