mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
Add support for tagging newly created DigitalOcean droplets.
This commit is contained in:
parent
63821381a0
commit
06eb9c30dd
@ -54,6 +54,7 @@ Set up an initial profile at ``/etc/salt/cloud.profiles`` or in the
|
||||
ipv6: True
|
||||
create_dns_record: True
|
||||
userdata_file: /etc/salt/cloud.userdata.d/setup
|
||||
tags:tag1,tag2,tag3
|
||||
|
||||
Locations can be obtained using the ``--list-locations`` option for the ``salt-cloud``
|
||||
command:
|
||||
|
@ -298,7 +298,8 @@ def create(vm_):
|
||||
'size': get_size(vm_),
|
||||
'image': get_image(vm_),
|
||||
'region': get_location(vm_),
|
||||
'ssh_keys': []
|
||||
'ssh_keys': [],
|
||||
'tags': []
|
||||
}
|
||||
|
||||
# backwards compat
|
||||
@ -379,6 +380,13 @@ def create(vm_):
|
||||
raise SaltCloudConfigError("'ipv6' should be a boolean value.")
|
||||
kwargs['ipv6'] = ipv6
|
||||
|
||||
tag_string = config.get_cloud_config_value(
|
||||
'tags', vm_, __opts__, search_global=False, default=False
|
||||
)
|
||||
if tag_string:
|
||||
for tag in tag_string.split(','):
|
||||
kwargs['tags'].append(tag)
|
||||
|
||||
userdata_file = config.get_cloud_config_value(
|
||||
'userdata_file', vm_, __opts__, search_global=False, default=None
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user