You can write a Filter Plugin and use that. Here are some that I have written and you can use that as an example. https://github.com/linuxdynasty/ld-ansible-filter-plugins In this example playbook, you can see how I use them. https://github.com/linuxdynasty/ansible-examples/tree/master/playbooks You can also read my blog post about it http://linuxdynasty.org/ansible-filters-and-how-they-can-make-aws-your-playbooks-dynamic/ .
You can see how much I love Filters :) On Fri, Oct 21, 2016 at 1:57 PM, <[email protected]> wrote: > 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 > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/ansible-project/83d60a73-d5be-4cda-9c92-73cbe78a79d4%40googlegroups. > com > <https://groups.google.com/d/msgid/ansible-project/83d60a73-d5be-4cda-9c92-73cbe78a79d4%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAH2deCYQDUXkv2beTeT-up_SCSBEhQ3tZJDV%2BZrv7MmqYQikNw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
