How salt can tag ec2 ebs volumes? I have tried all different ways I could think of, but non of them working:
First, tag volumes in profile:
block_device_mappings:
- DeviceName: /dev/sdb
Ebs.VolumeSize: 10
Ebs.VolumeType: standard
tags: { 'env': 'test' }
Secondly, tag volumes in salt state:
/dev/sdb:
boto_ec2.volumes_tagged:
- tag_maps:
- filters:
volume_ids: [ vol-0efe9141c40301871 ]
#'attachment.device': /dev/xvdb
- tags:
env: test
I got the error when the state was run:
Comment: An exception occurred in this state: Traceback (most recent call last):
File "/var/tmp/.root_5c1176_salt/py2/salt/state.py", line 1745, in call
**cdata['kwargs'])
File "/var/tmp/.root_5c1176_salt/py2/salt/loader.py", line 1702, in wrapper
return f(*args, **kwargs)
File "/var/tmp/.root_5c1176_salt/py2/salt/states/boto_ec2.py", line 1209, in volumes_tagged
r = __salt__['boto_ec2.set_volumes_tags'](**args)
File "/var/tmp/.root_5c1176_salt/py2/salt/modules/boto_ec2.py", line 1647, in set_volumes_tags
raise SaltInvocationError('Tag filters must be a dictionary: got {0}'.format(filters))
SaltInvocationError: Tag filters must be a dictionary: got None`
Finally, have looked the module boto_ec2.set_volumes_tags
, but I just could not find out the syntax and how to put the filters and tags.
Please anyone could show me how to tag volumes by salt. Thanks, Roger