aws_ssm - Get the value for a SSM parameter or all parameters under a path.
New in version 2.5.
Synopsis
- Get the value for an Amazon Simple Systems Manager parameter or a heirarchy of parameters. The first argument you pass the lookup can either be a parameter name or a hierarchy of parameters. Hierarchies start with a forward slash and end with the parameter name. Up to 5 layers may be specified.
- When explicitly looking up a parameter by name the parameter being missing will be an error.
- When looking up a path for parameters under it a dictionary will be returned for each path. If there is no parameter under that path then the return will be successful but the dictionary will be empty.
Requirements
The below requirements are needed on the local master node that executes this lookup.
- boto3
- botocore
Parameters
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
bypath | Default: no | A boolean to indicate whether the parameter is provided as a hierarchy. | |
decrypt | Default: yes | A boolean to indicate whether to decrypt the parameter. | |
recursive | Default: no | A boolean to indicate whether to retrieve all parameters within a hierarchy. | |
shortnames | Default: no | Indicates whether to return the name only without path if using a parameter hierarchy. |
Examples
# lookup sample: - name: lookup ssm parameter store in the current region debug: msg="{{ lookup('aws_ssm', 'Hello' ) }}" - name: lookup a key which doesn't exist, returns "" debug: msg="{{ lookup('aws_ssm', 'NoKey') }}" - name: lookup ssm parameter store in nominated region debug: msg="{{ lookup('aws_ssm', 'Hello', region=us-east-2 ) }}" - name: lookup ssm parameter store without decrypted debug: msg="{{ lookup('aws_ssm', 'Hello', decrypt=False ) }}" - name: lookup ssm parameter store in nominated aws profile debug: msg="{{ lookup('aws_ssm', 'Hello', aws_profile=myprofile ) }}" - name: lookup ssm parameter store with all options. debug: msg="{{ lookup('aws_ssm', 'Hello', decrypt=false, region=us-east-2, aws_profile=myprofile') }}" - name: return a dictionary of ssm parameters from a hierarchy path debug: msg="{{ lookup('aws_ssm', '/PATH/to/params', region=ap-southeast-2, bypath=true, recursive=true' ) }}" - name: return a dictionary of ssm parameters from a hierarchy path with shortened names (param instead of /PATH/to/param) debug: msg="{{ lookup('aws_ssm', '/PATH/to/params', region=ap-southeast-2, shortnames=true, bypath=true, recursive=true ) }}" - name: Iterate over a parameter hierarchy debug: msg='key contains {{item.Name}} with value {{item.Value}} ' loop: '{{ query("aws_ssm", "/TEST/test-list", region="ap-southeast-2", bypath=true) }}'
Status
Author
- Bill Wang <ozbillwang(at)gmail.com>
- Marat Bakeev <hawara(at)gmail.com>
- Michael De La Rue <siblemitcom.mddlr@spamgourmet.com>
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/plugins/lookup/aws_ssm.html