Yes, use hostvars.localhost.lmongo.stdout
On 23 July 2014 15:51, Benjamin Bauer <[email protected]> wrote: > I'm writing a playbook to restore the latest backup of my DB on all my > Database servers. This is done in two main steps: > > 1. figure out which backup is the latest (once) > 2. download that file to all DB servers > 3. ...and run the restore > > > While step 2 and 3 are straight forward, my problem is to *acquire the > correct filename once and share it among all DB hosts*. > > I was trying something like this for testing, but I cant access > `last_mongo` on the DB hosts. > > --- > - hosts: localhost > tasks: > - name: get filename of latest mongo backup > shell: s3cmd ls s3://my_backup_bucket/production/ | awk > 'NF{p=$4}END{print p}' > register: lmongo > - set_fact: last_mongo="{{lmongo.stdout}}" > - hosts: db > tasks: > - debug: > msg: "mongo: {{latest_mongo}}" > > > Is there a (idiomatic) way to make this variable accessible to the db > hosts? > > -- > 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/39e49d1f-3133-4aff-a987-7d3e0c213b04%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/39e49d1f-3133-4aff-a987-7d3e0c213b04%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/CAEhzMJAhtjCjod8x9xZrB4otPB4dhhs8cVuNBBu%2B4n_kaEW68Q%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
