Skip to content

Commit

Permalink
[ec2] Use user_data if specified (ansible#54494)
Browse files Browse the repository at this point in the history
* Use user_data if specified

* changelog
  • Loading branch information
s-hertel authored Apr 9, 2019
1 parent d53c3cd commit ba8b5ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

0 comments on commit ba8b5ec

Please sign in to comment.