I’m working on porting a shell script over to ansible, and I’m trying to capture the ARN of the latest automated snapshot without using the aws-cli or creating a standalone module. The shell command that would produce the value I’m looking for is
aws rds describe-db-snapshots
–query ‘DBSnapshots[?DBInstanceIdentifier==DB-INSTANCE-NAME
&&SnapshotType==automated
].{Arn: DBSnapshotArn}’
–output text | tail -n1
where DB-INSTANCE-NAME is replaced with the actual db instance name.
Coming from Puppet, I would create a parser function inside my roles or profile module written in Ruby. Is there a way to have dynamic variables kept close/in the playbooks, written in python?
Thanks