How to loop over these items ?

19 views
Skip to first unread message

Julien Syx

unread,
Aug 24, 2015, 2:24:46 PM8/24/15
to Ansible Project
Hello everyone,

I'm trying to create a role to manage backup with this script: https://github.com/redhat-cip/simple_ec2_snapshot

I would like to take in parameter a tags list (for example), then create a cron with the right command line.

How to iterate over the list and construct my command for my cron line please ?

For example, having :
tags:
  - { key: Name, value: test }
  - { key: env, value: prod }

And generate something like :
- cron: name="check dirs" minute="0" hour="5,2" job="simplec2snap.py {{ tags_loop }}" => job= "simplec2snap.py -t Name test -t env prod"

Thanks for giving me a clue ;-)

Cheers
Reply all
Reply to author
Forward
0 new messages